1.$location服务的使用
在angularjs的组件中定义,例如demo.js
module.controller('MainController', function($rootScope, $scope,$location){
$scope.urll=$location.search();
};
使用
假设URL为
http://192.168.139.215:8080/demo/#/drag?mid=null&yid=zouhuiying
在html中可以这样引用mid={{urll.mid}}&yid={{urll.yid}}
注:html中的onclick中不能引用angularjs的变量
可以用以下方式取值:
<div onclick="alert(this.innerHTML)" class="media-heading">{{user.name}}</div>
双向数据绑定
如果绑定的数据在子页面,要实现数据双向绑定要加入以下代码,在view中数据发生改变时,手动调用cha函数
$scope.safeApply = function(fn) {
var phase = this.$root.$$phase;
console.log(phase+"---phase");
if (phase == '$apply' || phase == '$digest') {
if (fn && (typeof(fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
};
$rootScope.cha = function() {
console.log("cha");
$scope.safeApply(function () {
$scope.greeting = document.getElementById("thism").value;
});
}
parseInt() 把字符串转化为int
使数组每次新加的元素放在数组首部
var t;
for(var i=0; i<$scope.notices.length-1; i++)
{
j=$scope.notices.length-1;
t=$scope.notices[i];
$scope.notices[i]=$scope.notices[j];
$scope.notices[j]=t;
};
$http服务的使用
$http.get('http://192.168.139.215:8080/p/usermenu.jsp').success(function(data) {
$scope.people = data;
}).then(function(data){
...//成功后执行的函数,不加then时会异步执行这段代码
};
$location服务的使用
$scope.people=$resource("http://192.168.139.215\\:8080/p/usermenu.jsp");
$scope.people.query()
分享到:
相关推荐
《精通AngularJS》深入浅出地讲解了AngularJS的开发概念和原理,并通过丰富的开发实例向读者展示了构建复杂应用的完整过程,包括学习使用AngularJS特有的基于DOM的模板系统,实现复杂的后端通信,创建漂亮的表单,...
AngularJS: Novice to Ninja is the perfect book to journey into the world of AngularJS, the superheroic JavaScript framework. Developed and maintained by Google, AngularJS brings the Model-View-...
AngularJS是一款优秀的前端JS框架,已经被用于Google的多款产品当中,并且得到众多前端工程师的青睐。, 《AngularJS高级程序设计》是AngularJS程序设计的高级指南。全书共25章,分为3个部分,每部分覆盖一组相关话题...
两本书的pdf:AngularJS中文版+精通AngularJS,提供方式:百度云链接+密码
Use a Material Design approach to position elements and create animations along with principles of the sophisticated AngularJS JavaScript framework. Take advantage of Angular Material, a UI component ...
<最新AngularJS开发宝典视频教程> ├最新AngularJS开发宝典—第001讲 什么是Angular及与Jquery实例对比分析.mp4 ├最新AngularJS开发宝典—第002讲 模块、控制器、视图模型、双向数据绑定模型、双向数据绑定.mp4 ├...
(精通AngularJS)Mastering Web Application Development with AngularJS code 源代码
Get introduced to the key features of AngularJS and understand its role in responsive design Learn various approaches for responsive web application development Discover practical examples to ...
AngularJS_权威教程.pdf AngularJS_深度剖析与最佳实践.pdf
这个我花了很大功夫下载的、是真正完整的、不做任何修改的、直接从官网下载的AngularJS的完整开发包(带文档)。具体的下载来源地址是https://code.angularjs.org/1.2.25/angular-1.2.25.zip。程序员不用太辛苦找...
A comprehensive guide to AngularJS, Google's open-source client-side framework for app development. Most of the existing guides to AngularJS struggle to provide simple and understandable explanations...
资源名称:AngularJS的介绍与研究 中文PPT版内容简介:AngularJS是一个前端的框架,跟后台的spring、struts框架类似,可以帮助我们快速的搭建和开发前端项目。与jquery等前端框架不同,AngularJS不仅仅是一个工具,...
本书是学习 AngularJS 的公认经典,内容全面,讲解通俗,适合各层次的学习者。作者拥有丰富的 AngularJS 开发和教学经验,也是一位全栈工程师。全书 35 章,由浅入深地讲解了 AngularJS 的基本概念和 基本功能,包括...
angularJS router filter service diractive
适合于AngularJS初学者
AngularJS Eclipse 插件为Eclipse提供对AngularJS的支持
AngularJS 开发 ASP.NET MVC.
angularjs实现上传图片并且预览
AngularJS[1] 诞生于2009年,由Misko Hevery 等人创建,后为Google所收购。是一款优秀的前端JS框架,已经被用于Google的多款产品当中。AngularJS有着诸多特性,最为核心的是:MVC、模块化、自动化双向数据绑定、语义...
spring springmvc mybatis bootstart angularjs简单案例,入门级