javascript - $routeParams in a controller for index.html -


i have application uses index controller main.js. want content defined url, want use $routeparams in controller. problem turns empty.

this in app.js

  .config(function ($routeprovider) {     $routeprovider         .when('/:guid', {             templateurl: '/index.html',             controller: 'mycollectionunitctrl'         })         .otherwise({             redirectto: '/'         });    }); 

the controller:

    .controller('mycollectionunitctrl',     function ($scope, $location, $routeparams) {         console.log($routeparams.guid); // undefined } 

i've doubled checked module-names same.

the problem none of code controller runs. tested adding console.log @ top. index not template, use no partials. i can't find routing when using 1 view, here's i'm stuck.

it doesn't work when define controller ng-controller neither.

ideas? i'm missing? stupid question that's explained documentation? appreciate comment, answers , feedback can give me.

thank you!

edit: i've tried define ng-controller in index.html, , have controller in routingconfig, did not work either.

edit2: plunker

its hard find out actual problem code snippet, think missing ngroute module.

add angular-route.js script in html , add ngroute dependency in module.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -