How do i get the value of pk
in the ng-href
and how do i call it into my controller.js
?
From what I can tell you're using ngRoute
, so in your module app.js
, inject ngRoute
, and $routeProvider
in the config like so;
angular.module("app", ['ngRoute']).config(function($routeProvider){
})();
Then in the body of the configuration;
$routeProvider.when("/candidate/:pk",
{
controller: "controller",
templateUrl: "htmlPage"
}
Now in your controller inject $routeParams
, and then;
$scope.pk = $routeParams.pk;
In the future I recommend adding more code, so the question makes a bit more sense, I don't know exactly what you're doing so this is a pretty generic answer.