Angular JS: How/when to use ng-click to call a route?
来源:互联网 发布:高铁豪华包厢知乎 编辑:程序博客网 时间:2024/05/07 04:13
http://stackoverflow.com/questions/14201753/angular-js-how-when-to-use-ng-click-to-call-a-route
Routes monitor the $location service and respond to changes in URL (typically through the hash). To "activate" a route, you simply change the URL. The easiest way to do that is with anchor tags.
<a href="#/home">Go Home</a><a href="#/about">Go to About></a>
Nothing more complicated is needed. If, however, you must do this from code, the proper way is by using the $location service yourself:
$scope.go = function ( path ) { $location.path( path );};
Which, for example, a button could trigger:
<button ng-click="go('/home')"></button>
0 0
- Angular JS: How/when to use ng-click to call a route?
- How to call a service function in AngularJS ng-click
- When and how to use a ThreadLocal
- How to use $http and $resource in Angular JS
- how to config when use hibernate+sqlserver2005
- How to hide keyboard when you click backgroud in a TTTableView?
- SD-How to get delivery plant when you use va01 to create a new order
- How to NSLog a Call stack when a program is running?
- How to programmatically click a WPF button
- Chinese version QQ—how to install it and use it to make a audio call and video call
- When not to use a word processor
- how to fix the assembly problem when project A call project B as reference
- Angular.js Use a preliminary introduction ng-class
- How to get the data from a cell when I click on the GridButtonColumn of the same row
- How to call a DLL Dialog resource
- How to delay a method call dynamically?
- When to use DMU?
- When to use AtomicReference?
- AngularJS with Cookies Example
- hduoj2002(计算球体积)
- Spring in Action 学习笔记—第一章开始Spring之旅
- Windows系统调用架构分析—也谈KiFastCallEntry函数地址的获取
- excel2010中自定义按钮〖宏〗
- Angular JS: How/when to use ng-click to call a route?
- Xcode5 创建模板和UIView 关联XIB
- 1211: [HNOI2004]树的计数 (prufer编码,排列组合,质因数分解)
- android之Intent复杂数据的传递一(Object类型的数据)
- Linq系列:基础与本质(Part II)
- poj 动态规划题集
- 7/21
- [INS-20802] Oracle Database Configuration Assistant 失败
- Cocos2dx-v3.1简单的Android编译实现