Abdullah Rasheed
Abdullah Rasheed

Reputation: 3752

UI-Router Module Not loading because Controller not found

I've searched the Ui-Router Controller Docs and read this here on stack overflow, along with other Google Searches. I'm trying to assign a controller to a state, but I get the the error:

Uncaught Typeerror: [$injector:modulerr]...controller cannot be found

I've borrowed a simpole Codepen to show a similar outcome to what I get in my code.

If I remove exampleCtrl from my state definition all works fine:

...
.state('tab1', {
   name: 'tab1',
   url: '/tab1',
   template: '<div class="tab tab1"><p>Caerphilly</p></div>',
   controller: exampleCtrl
})
...

Is this a matter of order? or am I missing something.

Upvotes: 0

Views: 53

Answers (1)

Nicolas2bert
Nicolas2bert

Reputation: 1152

controller: "exampleCtrl" instead of controller: exampleCtrl

Upvotes: 2

Related Questions