1.日期格式化

Letter Date or Time Component Presentation Examples
G Era designator Text AD
y Year Year 199696
M Month in year Month JulyJul07
w Week in year Number 27
W Week in month Number 2
D Day in year Number 189
d Day in month Number 10
F Day of week in month Number 2
E Day in week Text TuesdayTue
a Am/pm marker Text PM
H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12
m Minute in hour Number 30
s Second in minute Number 55
S Millisecond Number 978
z Time zone General time zone Pacific Standard TimePSTGMT-08:00
Z Time zone RFC 822 time zone -0800

2.scope之间通信(angular js)

父scope定义一个方法(假设controller为ParentCtrl)

$scope.$on('change-breadcrumb', function(event,data) {
$scope.breadcrumb = Util.breadcrumb("h"+$routeParams.id,data);
});

子scope触发父scope的方法(假设controller为ChildCtrl)

 $scope.$emit('change-breadcrumb',newValue);

此时可以执行父scope里面的方法,要注意的是在页面中的两个controller的位置

<div ng-controller="ParentCtrl">                <!--父级-->
<div ng-controller="ChildCtrl"></div> <!--子级-->
</div>

页面弹出框dialog不属于上面的页面布局,使用方法为

dialog.context_scope.$emit('change-breadcrumb',newValue);

更多细节请参见AngularJS的学习--$on、$emit和$broadcast的使用 - 疯狂的原始人

3.$.grep angular.forEach

$.grep() 方法是按照某种条件来过滤数组

nums = $.grep(nums, function (num, index) {
// num = 数组元素的当前值
// index = 当前值的下标
return isNaN(num);
});

angular.forEach方法用来循环数组

 angular.forEach($scope.templates, function (t) {
if ($scope.pool.template.id == t.id) {
$scope.pool.template = t;
     }
})

两者都有循环数组的功能,在angular js 中尽量用后者进行循环

4.使用session

angular.module('cvirt.login', ['ngCookies'])
.controller('loginController', loginController)
.controller('logoutController', logoutController);

在controller中声明session,并设置值即可

$cookieStore.put('token', escape(data.token));
$cookieStore.put('username', $scope.username);

获取session中的值

$cookieStore.get('username')

python , angular js 学习记录【1】的更多相关文章

  1. python , angular js 学习记录【2】

    1.不同scope之间的通信 (1)无父子关系的scope通信: 在需要操作的scope里面定义一个事件,名称为delete_host,参数为data $rootScope.$on('delete_h ...

  2. python , angular js 学习记录【3】

    1.Alembic是SQLAlchemy作者编写的Python数据库迁移工具.用它实现模型类和数据库的同步更新.(安装以及操作步骤 使用Alembic迁移数据库) 使用Alembic添加数据库字段操作 ...

  3. 适合我胃口的angular.js学习资料

    断断续续弄了半年的ANGULAR.JS学习资料,网上下载了N多资料,测试了很多次. 现在只能算是入门,因时间问题,现在要转入其它领域. 如果以后要拾起来,下面这个PDF比较对我胃口. <Angu ...

  4. 我的three.js学习记录(二)

    通过上一篇文章我的three.js学习记录(一)基本上是入门了three.js,但是这不够3D,这次我希望能把之前做的demo弄出来,然后通过例子来分析操作步骤. 1. 示例 上图是之前做的一个dem ...

  5. 我的three.js学习记录(三)

    此次的亮点不是three.js的3d部分,而是通过调用摄像头然后通过摄像头的图像变化进行简单的判断后进行一些操作.上篇中我通过简单的示例分析来学习three.js,这次是通过上一篇的一些代码来与摄像头 ...

  6. vue.js学习记录

    vue.js学习记录 文章已同步我的github笔记https://github.com/ymblog/blog,欢迎大家加star~~ vue实例 生命周期 beforeCreate:不能访问thi ...

  7. "利用python进行数据分析"学习记录01

    "利用python进行数据分析"学习记录 --day01 08/02 与书相关的资料在 http://github.com/wesm/pydata-book pandas 的2名字 ...

  8. D3.js学习记录【转】【新】

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. angular.js学习的第一天

    第一天对angular.js进行学习,肯定是面对的入门的最简单的实例: 实现下面的这个效果,首先需要在html页面引入angular.js,在下面的div中,ng-app则表示在当前div是一个ang ...

随机推荐

  1. hibernate缓存

    http://www.cnblogs.com/wean/archive/2012/05/16/2502724.html http://www.cnblogs.com/xiaoluo501395377/ ...

  2. 熟悉MyEclipse

    资源网址:http://www.myeclipsecn.com/learningcenter/ 20151126 [从这里开始]量身打造自己的MyEclipse(多图) 主要讲在MyEclipse里面 ...

  3. Mobile Safari调用本地App, 否则进入App Store下载

    需求: 如何让用户通过手机浏览器(Mobile Safari),访问一个URL就能直接打开ios上的App应用,如果该应用没有安装,那么直接跳转到App Store的App下载页面. 准备工作 ios ...

  4. haproxy 新手上路

    apache.nginx之类的反向代理(转发)功能,通常只能用于http协议,其它协议就不好使了(注:nginx据说商业版的,支持tcp协议了). haproxy可以弥补这方面的不足,haproxy支 ...

  5. Zencart视频教程 Zencart模板制作教程视频 Zencart仿站教程资料

    Zen Cart是国外一个免费的.界面友好,开放式源码的购物车软件,是目前外贸行业使用最为广泛的网站程序.本仿站技术需要你有一定的html和css基础,易学易懂,一步一步地教你操作和使用Zen Car ...

  6. [Leetcode] Course Schedule

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  7. Spring+Quartz实现定时任务

    MessageMgr.java package com.uyao.bid.common.message; import com.pominfo.framework.exception.PomInfoE ...

  8. sqlserver 游标

    DECLARE ChangeInvCodeCursor CURSOR FOR SELECT A.name AS tablecolumn,C.name AS tablename FROM sys.col ...

  9. android MVC && MVP && MVVM分析和对比

    相关:http://www.cnblogs.com/wytiger/p/5305087.html 出处http://blog.csdn.net/self_study,对技术感兴趣的同鞋加群544645 ...

  10. 解决:Error: JAVA_HOME is not defined correctly

    问题重现: Error: JAVA_HOME is not defined correctly. We cannot execute :/usr/lib/jvm/java-7-oracle 问题分析: ...