AngularJs获取链接中的参数

1、被获取的链接

http://localhost:8080/channel-manager-web/unifiedPlayNewService/broadcastingManageNew?type=1

2、配置一个config,如下图

config(['$locationProvider', function ($locationProvider) {
            $locationProvider.html5Mode(true);
        }])

 

AngularJs获取链接中的参数_第1张图片

3、在controller中获取type值

AngularJs获取链接中的参数_第2张图片

app.controller('formCtrl', ['$scope', '$location', function ($scope, $location) {

  alert($location.search().type); -- 这段就是用来获取url参数中type值

}]);

 

你可能感兴趣的:(angularjs)