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

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -

Qt4: how to send QString inside a struct via QSharedMemory -