There are two ways to naviagting between state:
  1. Using $state service, $state.go()

  2. Using ui-serf diretive

$state.go

Inject $state service.

   .controller('MainController', function ($scope , $state) {

       ...

        function setCurrentCategory(category) {

            $scope.currentCategory = category;
$state.go('eggly.categories.bookmarks', {category: category.name}); cancelCreating();
cancelEditing();
} ....

$state.go('eggly.categories.bookmarks', {category: category.name}),

in which eggly.categories.bookmarks is state name in bookmarks.js and category: is the state param.

    .config(function ($stateProvider) {
$stateProvider
.state('eggly.categories.bookmarks', {
url: 'categories/:category',
views: {
'bookmarks@': {
controller: 'BookmarksController',
templateUrl: 'app/categories/bookmarks/bookmarks.tmpl.html'
}
}
}) })

ui-sref

<a ng-click="setCurrentCategory(null)"><img class="logo" src="assets/img/eggly-logo.png"></a>
<ul class="nav nav-sidebar">
<li ng-repeat="category in categories" ng-class="{'active':isCurrentCategory(category)}">
<a ui-sref="eggly.categories.bookmarks({category: category.name})" ng-click="setCurrentCategory(category)">
{{category.name}}
</a>
</li>
</ul>

ui-sref="eggly.categories.bookmarks({category: category.name})", using state name: eggly.categories.bookmarks , as here function name.

[Angular-Scaled Web] 6. Navigating between states with ui-router的更多相关文章

  1. 混合开发 Hybird Ionic Angular Cordova web 跨平台 MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  2. angular 的ui.router 定义不同的state 对应相同的url

    Angular UI Router: Different states with same URL? The landing page of my app has two states: home-p ...

  3. angular : $location & $state(UI router)的关系

    次序:angular 的 location会先跑 $rootScope.$on("$locationChangeStart", function (scope, newUrl, o ...

  4. angular ui.router 路由传参数

    angular已经用了一段时间了,最近在做路由,做一下笔记. 路由跳转的时候进行穿参 ui.router方式 <a ui-sref="edit({id:5})"> 编辑 ...

  5. vue,react,angular三大web前端流行框架简单对比

    常用的到的网站 vue学习库: https://github.com/vuejs/awesome-vue#carousel (json数据的格式化,提高本地测试的效率) json在线编辑: http: ...

  6. angular模拟web API

    现象:angular Cannot find module 'angular-in-memory-web-api'报错找不动“angular-in-memory-web-api”模块 解决:1.控制台 ...

  7. Angular+ionic2 web端 启动程序出现短暂 白屏或黑屏 的处理小妙招

    在ionic2项目启动是会出现短暂的白屏或者黑屏,虽然很短,但是用户体验不太好.上网查了相关的资料,都是针对打包APP的解决办法,针对浏览器端使用的项目没有效果,所以自己写了样式,巧妙的避开这个问题, ...

  8. 树莓派做下载机+Web服务器(Aria2下载+yaaw做UI+nginx)

    今天收到了小派,UK产的绿板子,还配了个透明盒子,装在里面闪亮亮的很好看,而且只有卡片大小,寻思着用它做什么好呢?想来想去,看到人家拿小派作家庭媒体中心,还有人拿它当下载机,于是就萌生了一个家庭媒体中 ...

  9. web前端设计:JQuery MINI UI

    JQuery MINIUI 个人感觉用起来很爽,所以在此记录之,以后开发过程可能作为备选项.它能缩短开发时间,减少代码量,使开发者更专注于业务和服务端,轻松实现界面开发,带来绝佳的用户体验.在线下载地 ...

随机推荐

  1. Python并发编-用Event,线程检测数据库连接的例子

    尝试3次连接数据库 import time import random from threading import Thread,Event def connect_db(e): count = 0 ...

  2. django 编码错误

    估计这个问题是2.7的问题3.0好像就统一utf编码了 报错代码: python :ascii codec can't decode byte 0xe8 in posi 当django中报这个错误的时 ...

  3. 【BZOJ 3812】 3812: 主旋律 (容斥原理**)

    3812: 主旋律 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 235  Solved: 196 Description 响应主旋律的号召,大家决定 ...

  4. PHP 笔记——String 字符串

    1. 定义 单引号括起来的字符串被原样输出. 双引号字符串中的变量被PHP解析为变量值. 2. 获取字符串长度 strlen(string $string): int 在utf-8下,汉字占3个字符, ...

  5. 理解HashSet及使用

    (1) 为啥要用HahSet?    假如我们现在想要在一大堆数据中查找X数据.LinkedList的数据结构就不说了,查找效率低的可怕.ArrayList哪,如果我们不知道X的位置序号,还是一样要全 ...

  6. 高斯消元法求解异或方程组: cojs.tk 539.//BZOJ 1770 牛棚的灯

    高斯消元求解异或方程组: 比较不错的一篇文章:http://blog.sina.com.cn/s/blog_51cea4040100g7hl.html cojs.tk  539. 牛棚的灯 ★★☆   ...

  7. 小识.htaccess文件

    .htaccess文件(或者"分布式配置文件")提供了针对目录改变配置的方法, 即,在一个特定的文档目录中放置一个包含一个或多个指令的文件, 以作用于此目录及其所有子目录.作为用户 ...

  8. ReactNative-地图导航-iOS

    需求描述 项目中,要求接入导航功能,包括“百度map.高德map”. 方案分析 原生开发角度分析 从原生开发的角度分析的话,常规的思路可能是 分别取百度.高德官网,下载对应的SDK然后集成到本地: 创 ...

  9. 使用Win2D在UWP程序中2D绘图(一)

    在新的Windows UWP程序中,引入了一个新的API库: Win2D.它是一个d2d的封装,可以直接使用C#来快速实现高效2D绘图了.这个API虽然在Win8.1时代就开始着手开发了,但最近才完善 ...

  10. Current-sense monitor and MOSFET boost output current

    A previous Design Idea describes a programmable current source that used a three-terminal National S ...