A bit of controller import confusion

//the html (see screen shot below)

//then in app.js

angular.module(‘starter’, [‘ionic’,‘controllersmod’])

//then a controller file

angular.module('controllersmod, [])

.controller(‘OneCtrl’, function ($scope) {
$scope.items = [
{title: “Item 1”},
{title: “Item 2”},
{title: “Item 3”}
];
});

//does not work. shows {{item.title}} in the view. what am i missing?

//could not get the forum editor to post my html correctly. here’s a screen shot.
image

Are you getting any error in the console/developer tools?

Yes.
Uncaught SyntaxError: Unexpected token ILLEGAL
ionic.bundle.js:7888 Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module controllersmod due to:
Error: [$injector:nomod] Module ‘controllersmod’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

I’m loading the file…maybe not correctly :smile:
last thing before the end of the head tag

<script src="js/controllers.js"></script>

You are using controllersmod as a dependency so the order must be this:

<script src="js/controllers.js"></script> 
<script src="js/app.js"></script>
1 Like

My apologies, I was missing a closing quote in the controller file
angular.module('controllersmod, []).
It actually works either way now, but what you’re saying makes sense…will correct that as well. Thx for the help!!