javascript - AngularJS Error with multiple controllers and Grunt -



javascript - AngularJS Error with multiple controllers and Grunt -

unable multiple controllers work grunt. grunt not issue though, combining files manually not work either. trying build application grunt , single controllers 1 per file build out application on time.

the controllers in individual files combined , minified grunt. works, , module looks right before minified. unminified illustration in script.js.

i getting error below: error: error:unpr unknown provider

'use strict'; angular.module('ontariodarts', []); // source: app/modules/events/eventcontroller.js angular.module('ontariodarts').controller('eventctrl', function ($scope) { $scope.events = [ { 'id': 1, 'name': '12th annual frank hanlon tournament', 'date': 20150117, 'time': 1000, 'image': 'images/events/frankhanlon20150128.jpg', 'flyer': '' }, { 'id': 2, 'name': '1st annual ken cadieux memorial christmas tournament', 'date': 20141227, 'time': 1000, 'image': 'images/events/kencadieux20141227.jpg', 'flyer': '' }, { 'id': 3, 'name': '8th annual presidents cup tournament', 'date': 20150313, 'time': 2000, 'image': 'images/events/presidentscup20150314.jpg', 'flyer': '' } ]; $scope.imagesettings = [{ 'height': 200, 'width': 155 }]; }); // source: app/modules/leagues/leaguecontroller.js angular.module('ontariodarts').controller('leaguectrl', function ($scope) { $scope.leagues = [ { 'id': 1, 'name': 'dixie summer dart league' }, { 'id': 2, 'name': 'etobicoke pub dart league' }, { 'id': 3, 'name': 'region of peel dart league'} ]; }); // source: app/modules/schedules/schedulecontroller.js angular.module('ontariodarts').controller('schedulectrl', function ($scope) { $scope.schedules = [ { "id": 1, "name": "november 1, 2014" }, { "id": 2, "name": "november 5, 2014" } ]; }); // source: app/modules/teams/teamcontroller.js angular.module('ontariodarts').controller('teamctrl', function ($scope) { $scope.teams = [ { 'id': 1, 'name': 'team 1' }, { 'id': 2, 'name': 'team 2' } ]; }); //# sourcemappingurl=ontariodarts.js.map

plunker

i found out in plunker file name script.js instead of scripts.js. referenced wrongly in html.

please consider when minify

following safest way write minification

angular.module('ontariodarts').controller('eventctrl', ['$scope', function ($scope) { //controller code goes here }]);

you have utilize array notation controller function understand $scope.

['$scope', function ($scope) { //controller code goes here }]

javascript angularjs node.js controllers

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -