have to error when i create 3 controller
hi you. when i create 3 controller is
angular.module('app.core', [])
.controller('WhatsOnController', function($scope) {
var vm = this;
vm.title="This is title of what's on page";
});
and
angular.module('app.core', [])
.controller('MyShowsController', function($scope) {
var vm = this;
vm.title="This is title of my show page";
});
and
angular.module('app.core', [])
.controller('SearchController', function($scope) {
var vm = this;
});
i have route.js
angular.module('app.routes',['ngRoute']).config(routes);
function routes($routeProvider){
$routeProvider
.when('/',{
templateUrl:'sections/whats-on/whats-on.tpl.html',
controller:'WhatsOnController as whatsOn'
})
.when('/my-shows',{
templateUrl:'sections/my-shows/my-shows.tpl.html',
controller:'MyShowsController as myShows'
})
.when('/search',{
templateUrl:'sections/search/search.tpl.html',
controller:'SearchController as search'
})
.otherwise({
redirectTo:'/'
})
}
the first controlller run: ok but second and 3th have to error: Argument 'MyShowsController' is not a
what is should i do?
Looks correct, did you add all your controllers in index.html?
Incase anybody stumbles upon this old thread. In the above example the app.core module is being created three times with angular.module('app.core', []). To add a controller to a module without creating it, simply remove the [], so angular.module('app.core').controller('MyShowsController') would do it.
I am having error like while start the server :Local workspace file ('angular.json') could not be found. Error: Local workspace file ('angular.json') could not be found.
can you please explain and how can I correct it????? @RevillWeb
@ravik1086 It seems like you're using Angular not AngularJS