转自:http://blog.csdn.net/violet_day/article/details/17515157

$stateProvider

$stateProvider.state(stateName, stateConfig)

Creates a new application state. For alternate usage, see Object-based States

The parameters for .state() are:

stateName

String

一个唯一的状态的名称,比如‘home’,'about','contacts',创建子状态用'.',比如 "about.sales", "home.newest". Read more about nested states: Nested States & Nested Views

// The state() method takes a unique stateName (String) and a stateConfig (Object)
$stateProvider.state(stateName, stateConfig); // stateName can be a single top-level name (must be unique).
$stateProvider.state("home", {}); // Or it can be a nested state name. This state is a child of the above "home" state.
$stateProvider.state("home.newest", {}); // Nest states as deeply as needed.
$stateProvider.state("home.newest.abc.xyz.inception", {}); // state() returns $stateProvider, so you can chain state declarations.
$stateProvider.state("home", {}).state("about", {}).state("contacts", {});

stateConfig

Object

一个config的object对象接受已下属性

template, templateUrl, templateProvider

三种方式启动你的模板,三选一

template HTML标签或者返回HTML标签的函数

templateUrl URL或返回URL的函数

templateProvider 函数,返回HTML标签

Learn more about state templates

controller, controllerProvider

状态对应的控制器

controller 函数或者控制器的名称

controllerProvider 控制器提供者,动态的返回一个控制器的名称

Learn more about controllers

resolve

依赖注意控制器的一个对象

resolve Object

  • keys - 被注入控制器的名称
  • factory - {string|function} 如果是string,则作为服务的别名,如果是函数,他的返回值将会被依赖注入,如果返回promise,他会在注入控制器之前执行

Learn more about resolve

url

导航或转换到时,$
stateParams将被传递

url String

Learn more about url routing with states

params

An array of parameter names or regular expressions. Only use this within a state if you are not using
url. Otherwise you can specify your parameters within the url. When a state is navigated or
transitioned to, the $stateParams service will be populated with any parameters that were passed.

params Array

Learn more about parameters (examples are shown in url form, but they work just the same here)

views

使用视图属性来设置多个视图。如果你没有在一个state内需要多个视图这个属性是没有必要的。提示:请记住,通常嵌套的视图比平级的视图更加有用和强大。

views Object

Learn more about multiple named views

abstract

抽象的状态永远不会被激活,但是可以提供属性以被其子状态继承。

abstract Boolean - (default is false)

Learn more about abstract states

onEnter,
onExit

进入或退出时的回调函数。Callback functions for when a state is entered and
exited. Good way to trigger an action or dispatch an event, such as
opening a
dialog.

  • onEnter Function, injected including resolves
  • onExit Function, injected including resolves

Learn more about state callbacks

data

任意数据对象,用于自定义配置非常有用。Arbitrary data object, useful for custom configuration.

data Object

Learn more about attaching custom data to states

ui-router---$stateProvider的更多相关文章

  1. angularjs的路由ui.router

      <!-- 引入路由插件 --> <script src="vendor/angular-ui-router/release/angular-ui-router.min. ...

  2. AngularJS学习之 ui router

    1.安装 bower install --save angular_ui-router 2.在项目主页面 index.html中添加 <div ui-view="">& ...

  3. 新建一个angularjs+requirejs+bootstrap+typescript+gulp+vscode+git的项目

    环境 windows 10 准备工具 Visual Studio Code Node.js Git 需求 必须支持IE8 步骤开始: 执行命令行工具 mkdir Demo && cd ...

  4. ui-router API

    ui-router API 英文不咋地感觉找个API都要找半天, 拿好不谢 http://angular-ui.github.io/ui-router/site/#/api/ui.router

  5. [AngularJS] AngularJS系列(2) 中级篇之路由

    目录 原理 angular-route ui-router 事件 深度路由 原理 ng的route本质是监听hashchange事件. 在angular-route中 $rootScope.$on(' ...

  6. angular路由——ui.route

    angular路由 使用案例 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  7. 【原创】ui.router源码解析

    Angular系列文章之angular路由 路由(route),几乎所有的MVC(VM)框架都应该具有的特性,因为它是前端构建单页面应用(SPA)必不可少的组成部分. 那么,对于angular而言,它 ...

  8. 翻译:深入 AngularUI Router

    原文地址:http://www.ng-newsletter.com/posts/angular-ui-router.html ui-router: https://angular-ui.github. ...

  9. 单页应用跳转ui-view,$stateProvider,$urlRouterProvider

    <!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta charset="UTF- ...

  10. angular $stateProvider 路由的使用

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

随机推荐

  1. 程序员 10Tips

    理解技术债务 技术债务就像信用卡一样,会有很高的利息率,时间越长,修复所花的代价就越大,程序员对这个要有深刻的认识.同时团队应该培养一种保证设计质量的文化,应当鼓励重构.同时也应当鼓励其它有关代码质量 ...

  2. 生成makefile文件编译源文件

    1.利用CodeBlock的cbp文件生成makefile文件 reverse@ubuntu:~/Desktop/CreateMakeFile$ ls cbp2make.linux-x86 freeg ...

  3. margin问题

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  4. 简单三段式状态机实验1-SOS

    一直想从一段式状态机切换到三段式状态机,从书上和网上不断搜寻三段式案例及方法,感觉很简单,就想拿之前做过的实验把一段式改成三段式,可是写起来并非那么简单,很棘手,改完后也没有成功,尤其状态机里面的计数 ...

  5. 基于Verilog HDL的ADC0809CCN数据采样

    本实验是用ADC0809CCN进行数据采样,并用7段数码管进行显示. ADC0809由一个8路模拟开关.一个地址锁存与译码器.一个A/D转换器和一个三态输出锁存器组成.多路开关可选通8个模拟通道,允许 ...

  6. ural1987 Nested Segments

    Nested Segments Time limit: 1.0 secondMemory limit: 64 MB You are given n segments on a straight lin ...

  7. DEDECMS整站复制

    1. 登录你的网站(织梦系统DedeCMS)后台,到“系统”–“系统设置”–“数据库备份/还原”,点击“数据备份选择”下面的“提交”: 2.拷贝备份的数据库文件到根目录/data/backupdata ...

  8. (中等) CF 555E Case of Computer Network,双连通+树。

    Andrewid the Android is a galaxy-known detective. Now he is preparing a defense against a possible a ...

  9. Hibernate3提供的属性的延迟加载功能

    Hibernate3增强了对实体属性的延迟加载功能,要实现这个功能,分两个步骤 1.在hbm配置文件上对某个property设置lazy=true   <property name=" ...

  10. Windows Azure Table Storage 解决 Guid 查询问题

    在使用 Windows Azure Table Storage 的 CloudTableClient 对Azure 进行数据查询时,会发现在自定义类的Guid类型始终无法去成功查询出数据,对比发现 G ...