Thursday, 15 January 2015

angularjs - Angular Js Errors are not understandable -



angularjs - Angular Js Errors are not understandable -

i unable understand errors of angular js. trying build mill keeps on giving me next error in firefox console.

error: [ng:areq] http://errors.angularjs.org/1.2.9/ng/areq?p0=hospitalcontroller&p1=not%20a%20function%2c%20got%20undefined

my code

index

<div class="main ng-scope" ng-view="">

partial

<button data-ng-click="showstaff()">show</button>

app.js

var myapp = angular.module('myapp', [ 'ngroute', 'artistcontrollers' ]); myapp.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/list', { templateurl: 'partials/list.html', controller: 'listcontroller' }). when('/hospital', { templateurl: 'partials/hospital.html', controller: 'hospitalcontroller' }). when('/docter', { templateurl: 'partials/docters.html', controller: 'doctercontroller' }). when('/details/:itemid', { templateurl: 'partials/details.html', controller: 'detailscontroller' }). otherwise({ redirectto: '/hospital' }); }]);

controller.js

var artistcontrollers = angular.module('artistcontrollers', ['nganimate']); artistcontrollers.controller('listcontroller', ['$scope', '$http', function($scope, $http) { $http.get('js/data.json').success(function(data) { $scope.artists = data; $scope.artistorder = 'name'; }); // starting mill doc , hospital relationship artistcontrollers.factory( 'stafffactory','$http',function(){ var mill = {}; $http.get('js/hospital.json').success(function(data) { factory.hospitals = data; //$scope.hospitalorder = 'name'; }); $http.get('js/docters.json').success(function(data) { factory.doctors = data; //$scope.hospitalorder = 'name'; }); factory.getdocs = function(){ homecoming factory.doctors; }; factory.gethos= function(){ homecoming factory.hospitals; }; factory.getstaff = function(){ var result=[]; var endres=[]; angular.foreach(factory.hospitals, function(hospital){ result=[]; angular.foreach(factory.doctors,function(doc){ if(doc.id==hospital.id) { result.push(doc); } }); endres.push([hospital,result]); }); homecoming endres; } homecoming factory; }); artistcontrollers.simplecontroller=function($scope,stafffactory){ $scope.customers=[]; $scope.hospitals=[ ]; $scope.doctors=[]; $scope.staff=[]; init(); function init() { $scope.doctors=stafffactory.getdocs(); $scope.hospitals=stafffactory.gethos(); } $scope.showstaff = function() { $scope.staff=stafffactory.getstaff(); } }; // ending mill doc , hospital relationship }]);

in add-on actual error explained @dave, if want eror messages more explicit without having follow link, should utilize angular.js instead of angular.min.js (the minimized one) development environment.

angularjs

No comments:

Post a Comment