javascript - How is the array syntax supposed to work with Angular's $routeParams service? -


i'm learning javascript. in course, there following task:

inject routeparams service notesshowcontroller access id in url.

i wrote code:

angular.module('notewrangler') .controller('notesshowcontroller', [function($http, $routeparams) {   var controller = this;   $http({method:'get', url:'/notes/' + $routeparams.id})   .success(function(data){     controller.note = data;   }); }]); 

but error - teaching system says

make sure you're injecting $routeparams service correctly array syntax.

what's wrong $routeparams injection?

you need update

.controller('notesshowcontroller', [function($http, $routeparams) { 

to

.controller('notesshowcontroller', ['$http', '$routeparams', function($http, $routeparams) { 

Comments

Popular posts from this blog

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -