This controller works just fine:
function airlineRouter($routeProvider) {
$routeProvider
.when('/',
{
templateUrl:"partials/destinations.html",
controller: function($scope) {
$scope.setActive('destinations');
} //end controller
});
} //end airlineRouter
When I make the controller it's own JS file, it doesn't work anymore. Like this:
function airlineRouter($routeProvider) {
$routeProvider
when('/',
{
templateUrl:"partials/destinations.html",
controller: "DestinationsCtrl"
});
} //end airlineRouter
My Controller file resides in 'root/js/controllers/destinations.js', which is the same folder my 'app.js' file resides. The complete 'app.js' file looks like this:
angular
.module('airline', ['ngRoute'])
.config(airlineRouter);
function airlineRouter($routeProvider) {
$routeProvider
.when('/',
{
templateUrl:"partials/destinations.html",
controller: "DestinationsCtrl"
}
);
} //end airlineRouter
My complete controller JS file looks like this:
function DestinationsCtrl($scope) {
$scope.setActive('destinations');
} //end DestinationsCtrl
Why won't my controller load by the function name as this tut I'm doing says? The tut's file seems to work. Mine isn't.
Edit: console log shows this: Error: [ng:areq] Argument 'DestinationsCtrl' is not a function, got undefined
Edit 2: The tut I was working on was called 'Nesting Scopes', if that gives anyone a better idea of what I'm trying to do.
var app=module('airline'...then for controllersapp.controller('DestinationsCtrl', function($scope)...var app=angular.module('airline'...left outangularChangecontroller: "DestinationsCtrl"tocontroller: DestinationsCtrl