ng-app指令定义了应用, ng-controller 定义了控制器
2017-02-06 11:52
405 查看
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
名:<input type="text" ng-model="firstName"><br/>
姓:<input type="text" ng-model="lastName"><br/>
姓名:{{firstName + " " + lastName}}
</div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module('myApp',[]);
app.controller('myCtrl',function($scope){
$scope.firstName = "John";
$scope.lastName = "Doe";
});
</script>
</html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
名:<input type="text" ng-model="firstName"><br/>
姓:<input type="text" ng-model="lastName"><br/>
姓名:{{firstName + " " + lastName}}
</div>
</body>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script>
var app = angular.module('myApp',[]);
app.controller('myCtrl',function($scope){
$scope.firstName = "John";
$scope.lastName = "Doe";
});
</script>
</html>
相关文章推荐
- iOS 5 编程-应用选项卡栏控制器(UITabBarController)创建App
- (五)带属性值的ng-app指令,实现自己定义模块的自己主动载入
- iOS7应用开发5、视图控制器View Controller及其生命周期
- 【Angular】ng-app指令:确定应用程序的边界
- angularjs指令系统系列课程(5):控制器controller
- AngularJS(四)——ng-controller(控制器)
- AngularJS中给ng-app指令赋值和不赋值的区别
- AngularJS 在同一个界面启动多个ng-app应用模块详解
- AngularJS如何在同一个界面启动多个ng-app应用模块
- controller 使用的时候,ng-app 必须有名字
- Angular(五)_控制器ng-controller
- 基于RYU控制器(controller)上的simple-switch 的APP做的测试-SDN/OpenFlow
- angular指令中使用ngModelController
- iOS开发:第一个iOS程序分析——AppDelegate.h文件和视图View、视图控制器ViewController
- iOS应用开发中UITabBarController标签栏控制器使用进阶
- data-ng-app 指令
- iOS7应用开发5、视图控制器View Controller及其生命周期
- (五)带属性值的ng-app指令,实现自定义模块的自动加载
- 基于RYU控制器(controller)上的simple-switch 的APP做的測试-SDN/OpenFlow
- AngularJS ng-controller 指令简单实例