控制器
function PhoneDetailCtrl($scope, $routeParams) {$scope.phoneId = $routeParams.phoneId;}
路由规则如下
angular.module('phonecatApp').config(['$routeProvider',function config($routeProvider) {$routeProvider.when('/phones', {template: ''}).when('/phones/:phoneId', {template: ''}).otherwise('/phones');}]);
创建模块注入$服务提供配置路由规则
注意事项:
为了让我们的应用引导我们新创建的模块,我们同时需要在[ngApp]指令的值上指明模块的名字
app/index.html
...
模板
$route服务通常和[]指令一起使用 。指令的角色是为当前路由把对应的视图模板载入到布局模板中
如下所示
...="lib/angular/angular.js">="js/app.js">="js/controllers.js">
删除的模板放置在phone-list.html中
- 1 RTSP学习概念
- 办标签印刷厂都需要哪些证,什么店需要办理印刷经营许可证?
- ipadair有高刷新率吗
- 剪豆怎么种,欢乐豆怎么刷
- 三月份跳槽了,历经字节测开岗4轮面试,不出意外,被刷了...
- 安庆娱乐—安庆娱乐2023官方版安卓fxzls-1.2-安卓-fxls11
- 剑三静静怎么抓,剑网三威望怎么刷快
- 阿塞拜疆语;阿塞拜疆语翻译成中文
- Podman 已成 Linux 官方标配,Docker 没戏了?
- 刷战力先打排位还是巅峰赛,王者荣耀玩排位赛还是巅峰赛容易上国服