数据绑定和第一个AngularJS 应用

Hello 小朋友

一:

<input ng-model="name" type="text" placeholder="Your Name">
<h1>Hello {{ name }}</h1>

 二:

<body ng-app="myApp">
    <div ng-controller="MyController">
        <h1>Hello {{ name }}</h1>
    </div>
<script> var myApp = angular.module('myApp',[]); myApp.controller("MyController",function($scope) { $scope.name = "小朋友"; }); </script> </body>

 

posted @ 2017-03-01 10:54  小朋友663  阅读(71)  评论(0编辑  收藏  举报