angularJs的各种服务和指令的使用场景

$location服务,获取页面跳转带的参数

比如说页面是这样的  localhost:9102/admin/goods.html#?id=123   如何获取这个id=123的值呢?????(注意:angularJs页面跳转必须是#?key=val  这种  切记)

  1. 在controller 中引入  $location 服务 
  2. 在需要的方法中添加这样一句话就ok       var id=$location.search()['id'];   便可以得到id=123 了。

ng-checked 指令

ng-checked=true 表示被选中,false表示未选中

猜你喜欢

转载自www.cnblogs.com/coder-lzh/p/9158214.html