angular js页面传递参数

var myapp=angular.module("myApp",["ngRoute","ui.router"]);
myapp.controller("FCtrl",function($scope,$state){
     $scope.toSecound=function(name){
           $scope.go("secound",{"name":name});
    }
});
myapp.controller("SCtrl",function($scope,$state,$stateParams){
    
           $scope.name=$stateParams.name;
    
});
myapp.config(function($stateProvider, $urlRouterProvider){
   $stateProvider
   .state("first",{
        url:"/first",
    templateUrl:"servicing/first.html",
    controller:"FCtrl" 
    })
    .state("first",{
        url:"/secound",
    templateUrl:"servicing/secound.html",
    controller:"SCtrl" 
    })
}

 

转载于:https://www.cnblogs.com/xiudu/p/7504063.html

你可能感兴趣的:(angular js页面传递参数)