$routeParams 实现路由指定参数
【摘要】后台管理系统权限控制到按钮级别,将每一个资源的key绑定在url中,渲染页面的时候去根据key来获取当前页面的按钮列表。
router.js
angular.module("app.router", [])
.config(['$routeProvider',function($routeProvider) {
$routeProvider
//单个参数
.when("/index/:paramName",{
templateUrl: "app/index",
controller: "indexCtrl"
})
//多个参数
.when("/index/:paramName1/:paramName2",{
templateUrl: "app/index",
controller: "indexCtrl"
})
}])
}());
controller.js
;(function () {
"use strict";
angular.module("app.ctrls")
.controller('indexCtrl', ['$scope', 'indexServices', '$routeParams',
function ($scope, indexServices, $routeParams) {
$routeParams.paramName
}]); }());
通过 :paramName 来指定路由的参数,然后在页面的控制器中使用 $routeParams.paramName 来解析参数。
随机推荐
- 解决MAC下PHP连接MYSQL错误Warning: mysql_connect(): No such file or directory in conn.php
今天在mac上用php去连接mysql数据库,出现了 mac PHP Warning: mysql_connect(): [2002] No such file... 详细例如以下所看到的: Dir ...
- ios学习:swift中实现分享到微博、facebook,twitter等
在swift中打开分享功能原来是如此的简单. 1.首先须要 import Social 2.在分享button事件以下 var controller:SLComposeViewController = ...
- Linux_Oracle10 下载安装
Linux_Oracle10 安装文档及oracle下载地址 http://download.csdn.net/detail/u012750578/8177405 一.启动数据库服务 [root@hq ...
- sc命令以及InstallUtil安装service
1.安装 https://stackoverflow.com/questions/8164859/install-a-windows-service-using-a-windows-command-p ...
- Centos7 ssh免密码登陆
摘要:安装openssl openssl-devel 不过有些centos自带 192.168.161.5 192.168.161.15 本版本用centos7 (192.168.161.5) yu ...
- nginx假死导致的问题回顾
背景: 网络大致拓扑型 定位到一台Nginx节点于凌晨Timewait异常,等到6K. 进程异常,ngx_http_realtime_request模块错误 错误日志: 2017/02/24 00:0 ...
- 分享一下vue ui的分页的用法
var newToAddLeave = function(){ var goIndex = { template:` <i-table :columns="overTimeList.c ...
- vue.js原生组件化开发(二)——父子组件
前言 在了解父子组件之前应先掌握组件开发基础.在实际开发过程中,组件之间可以嵌套,也因此生成父子组件. 父子组件创建流程 1.构建父子组件 1.1 全局注册 (1)构建注册子组件 //构建子组件chi ...
- Inter-process Communication (IPC)
For Developers > Design Documents > Inter-process Communication (IPC) 目录 1 Overview 1.1 I ...
- H+后台主题UI框架---整理
本篇文章是对H+这种框架进行整理,顺便了解一下标准的代码规范的写法. 一.表单: 1).下面是一个基本表单: 现在来看这个表单的结构: 1.整个表单的外框结构是一个div,至于padding和marg ...