1

I have recently switched to AngularJS 1.6. to make it easier to move to Angular2 and beyond if necessary. In a sample app I'm trying to create, I'm having trouble setting up ui-router 1.0 for components. Here is what I've tried so far:

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'
            }
    })

which gives the following error:

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

What am I missing ?

1 Answer 1

4

state options should be part of state definition.

.state('home', {
    url: '/',
    component: 'dashboard'
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.