代码

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. 关于8086中的jmp near ptr原理

    在8086汇编语言中.jmp 0x7c41 自己跳转到自己的位置,是一个死循环代码.对应的机器指令是e9fdffe9是跳转  fdff其实应该是fffd 也就是-3的补码. 执行到e9fdff相当于把 ...

  2. robot-framework 利用evaluate关键字生成随机数

    robot-framework 利用evaluate关键字生成随机数 最近用RF(robot-framework简称)操作MangoDB,需要直接将数据写到数据库里,又不想每次写的数据完全相同,就想到 ...

  3. 快速部署单节点RancherServer

    已安装 docker,并配置docker国内镜像源 docker version docker pull rancher/rancher:v2.2.0 docker run -d -p 80:80 - ...

  4. 从入门到自闭之Python名称空间

    名称空间: 内置空间:python解释器自带的一块空间 全局空间:py文件中顶格写的就是全局空间 局部空间:函数体中就是局部空间 加载顺序: 内置空间 全局空间 局部空间 # def func(): ...

  5. JDK 监控和故障处理工具总结 (转)

    出处:  JDK 监控和故障处理工具总结 JDK 监控和故障处理工具总结 JDK 命令行工具 jps:查看所有 Java 进程 jstat: 监视虚拟机各种运行状态信息 jinfo: 实时地查看和调整 ...

  6. 修改公司VS_UCOS工程BUG调试过程说明

    说明:公司里的工程中,使用VS_UCOS来调试应用程序.业务逻辑.方法是嵌入式和VS分别建一个工程,把底层驱动部分分别添加各自需要的源文件,头文件使用同一个.也就是嵌入式的驱动函数名和参数和VS的函数 ...

  7. Linux-1.3目录结构,基础命令

    1.Linux目录结构 2.Linux基础命令(常用) ctrl+alt+T(打开终端) cd 切换文件夹(pwd查看当前目录) cd /home 绝对路径 以根目录开头 cd admin 相对路径 ...

  8. Linux安全审计

    Client: OMAudit_agent.py #!/usr/bin/env python #coding:utf- import sys import socket import fcntl im ...

  9. 大数据学习(1)-shell脚本注意事项

    1.变量=值 (例如STR=abc)  不用加引号,但此时空格不再是空格字符,特殊字符可用于转义 2.等号两侧不能有空格 3.变量名称一般习惯为大写 4.双引号和单引号有区别,双引号仅将空格脱意,单引 ...

  10. k8s自签TLS证书

    自签TLS证书 TLS证书用于进行通信使用,k8s组件需要的证书有: 第一步:安装证书生成工具cfssl 在这之前需要先建立一个目录来存放安装的工具mkdir ssl,后面将安装的工具移动到各自的目录 ...