使用 ui-router 和 AngularJS 1.6。组件

Using ui-router with AngularJS 1.6. components

我最近切换到 AngularJS 1.6。以便在必要时更容易迁移到 Angular2 及更高版本。在我尝试创建的示例应用程序中,我无法为组件设置 ui-router 1.0。到目前为止,这是我尝试过的:

import { DashboardComponent } from './ng/dashboard.component.js';
import uiRouter from "@uirouter/angularjs";

export default angular
    .module('dashboardModule', ['ui.router'])
    .component('dashboard', DashboardComponent)
    .config(function($stateProvider) {
        $stateProvider
            .state('home'), {
                url: '/',
                component: 'dashboard'
            }
    })

出现以下错误:

Error: [$injector:modulerr] Failed to instantiate module dashboardModule due to:
TypeError: Cannot set property 'name' of undefined at StateProvider.state 

我错过了什么?

状态选项应该是状态定义的一部分。

.state('home', {
    url: '/',
    component: 'dashboard'
})