• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

凉梁凉糕

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

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

})

posted on 2017-09-29 14:21  凉梁凉糕  阅读(542)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3