<!DOCTYPE HTML>
<html ng-app="myApp">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
.red{ background:red;}
.yellow{ background:yellow;}
</style>
<script src="angular.min.js"></script>
<script>

/*var m1 = angular.module('myApp',[]);
m1.controller('Aaa',['$scope',function($scope){
$scope.text = 'hello';

}]);*/

var m1 = angular.module('myApp',[]);
m1.controller('Aaa',['$scope',FnAaa]);

function FnAaa($scope){
}
FnAaa.prototype.num = '123';
FnAaa.prototype.text = 'hello';
FnAaa.prototype.show = function(){
return 'angularJS';
};

</script>
</head>

<body>
<!--<div ng-controller="Aaa">
<input type="text" ng-model="text" ng-model-options="{updateOn : 'blur'}">
<div>{{text}}</div>
</div>-->
<div ng-controller="FnAaa as a1">
<div>{{a1.text}}:{{a1.show()}}</div>
</div>
</body>
</html>

angularjs中ng-controller中绑定对象的更多相关文章

  1. 走进AngularJs(二) ng模板中常用指令的使用方式

    通过使用模板,我们可以把model和controller中的数据组装起来呈现给浏览器,还可以通过数据绑定,实时更新视图,让我们的页面变成动态的.ng的模板真是让我爱不释手.学习ng道路还很漫长,从模板 ...

  2. ASP.NET MVC 中单独的JS文件中获取Controller中设定的值

    1,在Controller中的Action 中将指定值写上.       //       // GET: /Home/       public ActionResult Index()       ...

  3. MVC中的Controller中返回一个JsonResult在弹出一个下载框?

    public JsonResult ReturnTest() { return Json(new {myMsg ="hello world"}, "text/html; ...

  4. koa2 controller中实现类似sleep的延迟功能

    今天有同事问我如何在koa2中的controller中使用延迟执行的功能,他直接在controller中使用setTimeout,但是没效果. 错误的代码类似下面这样: // 错误的方法 export ...

  5. angularjs 中使用 service 在controller 之间 share 对象和数据

    在做angularjs 的UI 时,我们经常会遇到一个页面之间有几个controller,在controller 之间share 公共的一些数据和方法就变得比较困难,目前推荐的做法是创建一个servi ...

  6. 深入学习AngularJS中数据的双向绑定机制

    来自:http://www.jb51.net/article/80454.htm Angular JS (Angular.JS) 是一组用来开发Web页面的框架.模板以及数据绑定和丰富UI组件.它支持 ...

  7. angularjs学习笔记3-directive中scope的绑定修饰符

    在angularjs中,一个directive返回一个对象,对象存在很多属性,并且可以在directive中自定义自己的scope,而使用自己的scope是为了防止一个directive被使用在多个地 ...

  8. angularjs中的单选框绑定数据注意事项

    这里说的是angularjs 1.x 在实现单选框时,我们完全可以用html自带的<input type="radio"/>,但是配合angularjs 中的双向绑定, ...

  9. Spring拦截器中通过request获取到该请求对应Controller中的method对象

    背景:项目使用Spring 3.1.0.RELEASE,从dao到Controller层全部是基于注解配置.我的需求是想在自定义的Spring拦截器中通过request获取到该请求对应于Control ...

  10. Angularjs中的Controller

    概念:一个应用(APP,本身也是一个大模块)是由若干个模块(module)组成的,每个模块实现一个功能.利于代码的复用. 书写格式: <!DOCTYPE html> <html ng ...

随机推荐

  1. iOS LaunchImage 各尺寸

  2. 将UINavgationController的push改成从左到右

     CATransition* transition = [CATransition animation]; transition.type = kCATransitionPush;        // ...

  3. jQuery+HTML5实现上传文件预览

    <!DOCTYPE html> <html> <head> <title>HTML5上传图片预览</title> <meta http ...

  4. 清华学堂 LightHouse

    灯塔(LightHouse) Description As shown in the following figure, If another lighthouse is in gray area, ...

  5. iOS编程中遇到的问题

    1.应用在iPhone6plus 系统iOS9.1安装时没遇到问题,在iPhone4s 系统iOS 7时bulid success 但是安装失败提示 There was an internal API ...

  6. gitlab 创建SSH Keys 报500错

    gitlab 创建SSH Keys 报500错 看了一下日志 root@322323:/home/git/gitlab/log# cat production.log Errno::ENOMEM (C ...

  7. mongoose连接collection后自动加s的问题

    这两天折腾mongoose,发现数据成功写入集合了,但是在Terminal查询的时候却查不到 于是show collections后发现在原来的集合底下,又生成了一个加了s的集合,shenmegui ...

  8. 【Alpha】Daily Scrum Meeting第七次

    一.本次Daily Scrum Meeting主要内容 各队员的任务完成情况 文件选择器布局只是暂时使用,后期会改方式,放在后面解决. 接下去都要做什么 二.项目进展 学号尾数 今日已完成任务 接下去 ...

  9. 利用win7usb-dvdtool工具u盘安装win7

    首先介绍下背景:我的电脑是两块盘,然后系统是ubuntu,但是因为最近觉得linux不怎么用了,所以想装回windows,这个过程遇到好多麻烦,主要是两方面的 1.不识别u盘做的启动盘2.两块硬盘导致 ...

  10. PHP的开发环境

    快速搭建工作环境,测试环境,开始PHP的编程之旅. liunx CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL) 准备篇: 1.配置防火墙,开启80端口.3306端口v ...