代码

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的使用的更多相关文章

  1. ASP.NET Core 中文文档 第四章 MVC(4.1)Controllers, Actions 和 Action Results

    原文:Controllers, Actions, and Action Results 作者:Steve Smith 翻译:姚阿勇(Dr.Yao) 校对:许登洋(Seay) Action 和 acti ...

  2. 【转】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 ...

  3. 控制器层(Controllers)

    本章译者:@freewind 业务逻辑代码通常位于模型(model)层.客户端(比如浏览器)无法直接调用其中的代码,所以模型对象提供的功能,必须作为资源以URI方式暴露给外部. 客户端使用HTTP协议 ...

  4. Presenting view controllers on detached view controllers is discouraged <CallViewController: 0x14676e240>.

    今天在优化app时,发现程序出现这种警告:“ Presenting view controllers on detached view controllers is discouraged <C ...

  5. [译]在AngularJS中何时应该使用Directives,Controllers或者Service

    原文: http://kirkbushell.me/when-to-use-directives-controllers-or-services-in-angular/ Services Servic ...

  6. 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 ...

  7. 玩转单元测试之Testing Spring MVC Controllers

    玩转单元测试之 Testing Spring MVC Controllers 转载注明出处:http://www.cnblogs.com/wade-xu/p/4311657.html The Spri ...

  8. 就是这么简单(续)!使用 RestAssuredMockMvc 测试 Spring MVC Controllers

    就是这么简单(续)!使用 RestAssuredMockMvc 测试 Spring MVC Controllers 转载注明出处:http://www.cnblogs.com/wade-xu/p/43 ...

  9. 更轻量的 View Controllers

    iew controllers 通常是 iOS 项目中最大的文件,并且它们包含了许多不必要的代码.所以 View controllers 中的代码几乎总是复用率最低的.我们将会看到给 view con ...

  10. 【IOS笔记】Resource Management in View Controllers

    Resource Management in View Controllers 视图控制器的资源管理 View controllers are an essential part of managin ...

随机推荐

  1. mongodb 后台启动命令记录

    安装 解压到bin目录 , --logpath 属性必填 ./mongod --fork --dbpath=/home/mongodb/data --bind_ip=0.0.0.0 --port 36 ...

  2. [转帖]$PWD 和 $(pwd)

    $PWD 和 $(pwd) https://blog.csdn.net/shaojwa/article/details/51894980 细节决定成败.   注意两个效果一样,但是注意大小写,PWD是 ...

  3. pycharm 更换源 Windows Linux平台

    pycharm 更换源 Windows Linux平台 参考资料:https://blog.csdn.net/wls666/article/details/95456309 Windows下更新源 文 ...

  4. bash 转换为C代码

    bash 转换为C代码,并编译为可执行文件 [root@localhost ~]# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9. ...

  5. 111、什么是stack (Swarm18)

    参考https://www.cnblogs.com/CloudMan6/p/8119150.html   什么是 stack ?    在将这个之前先回顾一下前面部署WordPress的过程:     ...

  6. mybatis-plus简单了解

    mybatis-plus入门了解和简单使用 MyBatis-Plus(简称 MP)是一个 MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化开发.提高效率而生. 特性: ...

  7. 目标 - 在虚拟机CentOS7中无图形界面安装Oracle11G R2版本

    参考: https://www.cnblogs.com/yejingcn/p/10278473.html centos7启动oracle su - oracle //切换到自己的oracle账户 ls ...

  8. linux命令详解——vim

    显示行号:命令模式下set nu 定位到指定行: 命令模式下,:n   比如想到第2行,:2 编辑模式下,ngg  比如想到第5行 5gg(或者5G) 打开文件定位到指定行   vim  +n  te ...

  9. MySQL快速清空表数据

    truncate table 可以不删除表的情况下,快速情况表数据

  10. centos7 yum快速安装LNMP

    1.安装nginx yum install nginx ##开启nginx service nginx start 2.安装MYSQL yum localinstall http://dev.mysq ...