Controllers的使用
代码
angularjs.html <!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>AngualrJS进阶</title>
<link rel="stylesheet" type="text/css" href="css/foundation.css">
</head>
<body style="padding:10px;" ng-app="app">
<div ng-controller="FirstCtrl">
<input type="text"ng-model="msg">
<h1>{{msg}}</h1>
<br>
<h1 ng-bind="msg"></h1>
<!--可以使用ng-bind进行绑定,这样就不需要输入{{}}-->
</div>
<div ng-controller="SecondCtrl">
<input type="text" ng-model="msg">
<h1>{{msg}}</h1>
<!--同样是msg,但是显示的不同这就是控制器作用域的问题,这个msg绑定的是SecondCtrl-->
</div>
</body>
<script type="text/javascript" src="js/angular.js"></script>
<script type="text/javascript" src="js/myctrl.js"></script>
</html>
myctrl.js
angular.module('app',[])
.controller('FirstCtrl',function($scope){
$scope.msg="hello angular";
})
.controller('SecondCtrl',function($scope){
$scope.msg="hello angularjs"
})
Controllers的使用的更多相关文章
- ASP.NET Core 中文文档 第四章 MVC(4.1)Controllers, Actions 和 Action Results
原文:Controllers, Actions, and Action Results 作者:Steve Smith 翻译:姚阿勇(Dr.Yao) 校对:许登洋(Seay) Action 和 acti ...
- 【转】Controllers and Routers in ASP.NET MVC 3
Controllers and Routers in ASP.NET MVC 3 ambilykk, 3 May 2011 CPOL 4.79 (23 votes) Rate: vote 1vote ...
- 控制器层(Controllers)
本章译者:@freewind 业务逻辑代码通常位于模型(model)层.客户端(比如浏览器)无法直接调用其中的代码,所以模型对象提供的功能,必须作为资源以URI方式暴露给外部. 客户端使用HTTP协议 ...
- Presenting view controllers on detached view controllers is discouraged <CallViewController: 0x14676e240>.
今天在优化app时,发现程序出现这种警告:“ Presenting view controllers on detached view controllers is discouraged <C ...
- [译]在AngularJS中何时应该使用Directives,Controllers或者Service
原文: http://kirkbushell.me/when-to-use-directives-controllers-or-services-in-angular/ Services Servic ...
- How to Create Mixed Reality Videos for the Vive - with Two Controllers
http://secondreality.co.uk/blog/how-to-create-mixed-reality-videos-for-the-vive-with-two-controllers ...
- 玩转单元测试之Testing Spring MVC Controllers
玩转单元测试之 Testing Spring MVC Controllers 转载注明出处:http://www.cnblogs.com/wade-xu/p/4311657.html The Spri ...
- 就是这么简单(续)!使用 RestAssuredMockMvc 测试 Spring MVC Controllers
就是这么简单(续)!使用 RestAssuredMockMvc 测试 Spring MVC Controllers 转载注明出处:http://www.cnblogs.com/wade-xu/p/43 ...
- 更轻量的 View Controllers
iew controllers 通常是 iOS 项目中最大的文件,并且它们包含了许多不必要的代码.所以 View controllers 中的代码几乎总是复用率最低的.我们将会看到给 view con ...
- 【IOS笔记】Resource Management in View Controllers
Resource Management in View Controllers 视图控制器的资源管理 View controllers are an essential part of managin ...
随机推荐
- [转帖]Linux的wget命令详解
Linux的wget命令详解 来源不明 找到的也是转帖的 https://www.cnblogs.com/cindy-cindy/p/6847502.html Linux wget是一个下载文件的工具 ...
- 【C++ 补习】Copy Control
C++ Primer 5th edition, chapter 13. The Rule of Three If a class needs a destructor, it almost surel ...
- .Net Core 3.0使用Grpc进行远程过程调用
因为.Net Core3.0已经把Grpc作为一等臣民了,作为爱好新技术的我,当然要尝鲜体验一下了,当然感觉是Grpc作为跨语言的产品做的相当好喽,比起Dubbo这种的,优势和劣势还是比较明显的. 我 ...
- 尝试自己搭一个简单的typescript运行环境
开发typescript项目有一些现成的脚手架,比如:typescript-library-starter,它的配置齐全,更适合用在实际项目开发上.其实在学习阶段可以自己搭建一个简单的typescri ...
- MyBatis清空数据库表数据
<update id="truncateTable"> truncate table ${tableName} </update> <update i ...
- 稀疏矩阵三元组快速转置(转poklau123写的很清楚)
关于稀疏矩阵的快速转置法,首先得明白其是通过对三元表进行转置.如果误以为是对矩阵进行转置,毫无疑问就算你想破脑袋也想不出个所以然,别陷入死胡同了! 对于一个三元表,行为i,列为j,值为v.需将其i与j ...
- C数据结构排序算法——直接插入排序法用法总结(转http://blog.csdn.net/lg1259156776/)
声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 排序相关的的基本概念 排序:将一组杂乱无章的数据按一定的规律顺次排列起来. 数据表( data list): ...
- O001、写在最前面
参考https://www.cnblogs.com/CloudMan6/p/5224114.html <每天5分钟玩转 OpenStack> 1.系统讲解 OpenStac ...
- String和StringBuffer的常见用法
链接:https://www.nowcoder.com/questionTerminal/fe6b651b66ae47d7acce78ffdd9a96c7?answerType=1&f=dis ...
- vue iview表格应用
今天看一下iview表格的使用.本文中有以下内容 table的必备部分(columns,data) render函数的使用(判断,添加样式,动态添加class...) slot使用 主要讲render ...