javascript - console.log not working inside angular controller -


hi have been trying angular.j. have tried following code. console.log() not seems working. missing?? angular concepts or something?

var foodsharemodule= angular.module('food',['ui.router','ngresource']);  console.log("main file getting included");   foodsharemodule.controller("personcontroller", function($scope) {     console.log($scope);     $scope.firstname = "john";     $scope.lastname = "doe";     console.log($scope.firstname);     console.log($scope.lastname); });  foodsharemodule.controller('scratchlistcontroller', function($scope,$state,notes){     console.log("working");    $scope.scratchpad =food.query();    $scope.deletescratch = function (scratch,flag) {     if(flag === 0) {                                            //checks if bulk delete or single delete       if(confirm("you clicked delete !! sure ?")) {       scratch.$delete(function() {                          //single delete         window.location.href = 'http://localhost:1337';       });       }     }     else {                                                      //bulk delete       scratch.$delete(function() {         window.location.href = 'http://localhost:1337';       });     }    }    $scope.emptyscratchpad = function () {     var ask = false;     if (confirm ("you empty scratchpad. sure ????")) {       ask = true;     }     if(ask === true) {       (var = 0; < $scope.scratchpad.length; i++) {         $scope.deletescratch($scope.scratchpad[i],1);       }     }    } })    foodsharemodule.factory('food', function($resource) {   return $resource('http://localhost:1337/food:id', { id: '@_id' }, {     update: {       method: 'put'     }   }); }); 

any appreciated. in advance.

by looking @ code seems injected wrong dependency in scratchlistcontroller, should food instead of notes

code

foodsharemodule.controller('scratchlistcontroller', function($scope, $state, food) { //you added notes, there should food     console.log("working");     //..other code here }) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -