ui-router .state参数配置

.state('页面被引用时的变量名',{

  template: '<h1>My Contacts</h1>',//被应用时插入的模板,状态被激活时,它的模板会自动插入到父状态对应的模板中包含ui-view属性的元素内部。

  templateUrl:'指定的页面',//来加载指定位置的模板,可以是一个页面也可以是一个返回url的函数

  controller:‘function($scope){$scope.title = 'My Contacts';}’,//或者一个已经定义好的控制器的名字如indexCtrl 

  data: {                                  //可以给 $state 对象提供自定义数据
    customData1: 44,
    customData2: "red"
  },
  reslove:{         //可以使用resolve为控制器提供可选的依赖注入项
      user:function(){
         return {
          name:"shanon",
          email:"1111111111@qq.com"
          }
       },
       controllerAs:'demo'    //demo是定义好的控制器(以indexCtrl为例)的别名,这样在页面中可以使用{{demo.变量/方法}},其中的变量和方法是indexCtrl中$scope下面的变量和方法,实际可以将window.indexCtrl =             //this,使用this代替$scope

})

原文地址:https://www.cnblogs.com/xhliang/p/7483744.html