I am new to Angular.js and I have a question about passing postId to the fullPostController. Currently, the fullPostController is fetching data based on the id using $http, but how do I actually pass the postId to the controller?
'use strict';
var myAPP = angular.module('myAPP', [ 'ngRoute' ]);
myAPP.config(['$routeProvider',
function (
$routeProvider
) {
$routeProvider.
when('/', {
templateUrl: 'pages/home.html',
controller: 'mainController'
}).
when('/post/:postId', {
templateUrl: 'pages/full_post.html',
controller: 'fullPostController'
}).
otherwise({
redirectTo: '/'
});
}]);
Can anyone guide me on how to properly pass the postId to the fullPostController in this setup? Thank you.