Read parameters from URL
- Create a module
- The important part is the function that receive the $locationProvider
var app = angular.module('tagStatus', [], function ($locationProvider) {
$locationProvider.html5Mode(true);
});
- Create the function that is consider as Controller, in this case the name is QueryCntl
- The location.search() find the parameter, in this case 'page'
function QueryCntl($scope, $location) {
$scope.target = $location.search()['page'];
}
- In the HTML
- Include the Module and Controller
- Display the parameter
<div class="form_message" ng-app="tagStatus" ng-controller="QueryCntl as ctrl">
{{target}}
</div>
Comentarios
Publicar un comentario