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

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -