run
和配置块不同,运行块在注入器创建之后被执行,它是所有AngularJS应用中第一个被执行的方法
运行块通常用来注册全局的事件监听器。例如,我们会在.run()块中设置路由事件的监听器以及过滤未经授权的请求
angular.module('myApp', ['ngRoute'])
.run(function($rootScope, AuthService) {
$rootScope.$on('$routeChangeStart', function(evt, next, current) {
if (!AuthService.userLoggedIn()) {
if (next.templateUrl === 'login.html') {
} else {
$location.path('/login')
}
}
})
})
run的更多相关文章
- can't run roscore 并且 sudo 指令返回 unable to resolve host
I'm using ubuntu14 LTS. Problems: 1. When run roscore, got a mistake and an advice to ping the local ...
- DotNet Run 命令介绍
前言 本篇主要介绍 asp.net core 中,使用 dotnet tools 运行 dotnet run 之后的系统执行过程. 如果你觉得对你有帮助的话,不妨点个[推荐]. 目录 dotnet r ...
- 布里斯班Twilight Bay Run半程马拉松
自从8月3日跑了半马以后,又一鼓作气报了11月份的西昌马拉松.与第一次马拉松的只求完赛目标不同,第二次当然想取得一个更好的成绩.所以8月份练的比较猛,基本上是练2.3天休息一天,周么还要拉个长于21公 ...
- SVN:Previous operation has not finished; run 'cleanup' if it was interrupted
异常处理汇总-开发工具 http://www.cnblogs.com/dunitian/p/4522988.html cleanup failed to process the following ...
- linux 环境下运行STS时 出现must be available in order to run STS
linux 环境下运行ECLIPSE时 出现 “ A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be avai ...
- 0040 Java学习笔记-多线程-线程run()方法中的异常
run()与异常 不管是Threade还是Runnable的run()方法都没有定义抛出异常,也就是说一条线程内部发生的checked异常,必须也只能在内部用try-catch处理掉,不能往外抛,因为 ...
- jBPM4.4 no jBPM DB schema: no JBPM4_EXECUTION table. Run the create.jbpm.schema target first in the install tool.
jBPM4.4 no jBPM DB schema: no JBPM4_EXECUTION table. Run the create.jbpm.schema target first in the ...
- .NET跨平台之旅:探秘 dotnet run 如何运行 .NET Core 应用程序
自从用 dotnet run 成功运行第一个 "Hello world" .NET Core 应用程序后,一直有个好奇心:dotnet run 究竟是如何运行一个 .NET Cor ...
- 【svn】在提交文件是报错:previous operation has not finished;run 'cleanup' if it was interrupted
1.svn在提交文件是报错:previous operation has not finished;run 'cleanup' if it was interrupted2.原因,工作队列被占用,只需 ...
- svn报错cleanup failed–previous operation has not finished; run cleanup if it was interrupted的解决办法
今天在svn提交的时候它卡顿了一下,我以为已经提交完了,就按了一下,结果就再也恢复不了,也继续不了了... 报错 cleanup failed–previous operation has not f ...
随机推荐
- Charles破解网站收藏(持续更新)
1. 在这个网站(http://charles.iiilab.com/)下载破解文件 charles.jar 2. 替换掉原文件夹里的charles.jar Mac: /Applications/Ch ...
- Qt Widgets——工具栏和状态栏
本文主要涉及QSizeGrip ,QStatusBar ,QToolBar QToolBar 工具栏默认位于菜单栏下方,其上添加一个个action按钮,用于执行动作 绝大多谢以前都涉及过,只列出 QT ...
- js 日期格式: UTC GMT 互相转换
//UTC 转指定格式日期 let date = '2018-03-07T16:00:00.000Z' console.log(moment(date).format('YYYY-MM-DD HH:m ...
- axur axure rp安装
axure rp安装 1◆ axure rp 文件下载 2◆创建安装目录 3◆ 安装图解 4◆汉化 替换 5◆ 使用 success
- Python自然语言处理---TF-IDF模型
一. 信息检索技术简述 信息检索技术是当前比较热门的一项技术,我们通常意义上的论文检索,搜索引擎都属于信息检索的范畴.信息检索的问题可以抽象为:在文档集合D上,对于关键词w[1]…w[k]组成的查询串 ...
- Android 音视频深入 一 AudioRecord录音生成pcm转换为wav(附源码下载)
本篇项目地址,名字是AudioRecord录音(能暂停,将pch转换为wav),求starhttps://github.com/979451341/Audio-and-video-learning-m ...
- bzoj2045
题解: 莫比乌斯反演经典题目 直接套公式好了 代码: #include<bits/stdc++.h> using namespace std; ; typedef long long ll ...
- ssh三大框架整合
spring+struts2+hibernate 参考1:数据库为oracle http://takeme.iteye.com/blog/1678268 参考2:数据库为mysql http://bl ...
- HTML编辑笔记3
表单 1.语法 <form method="get|post" action="数据向哪提交的地址"> //表单内容 </form> 2 ...
- flask-admin有用的例子
flask-admin主页: https://github.com/flask-admin/flask-admin flask-admin克隆地址: https://github.com/flask- ...