Angular JS 学习

学习一个google 的开发的 前端js 框架   Angular JS。

参照的书:  Angular Js  published by O'REILLY。

第二个小例子:  有一个textbox 文本框,当输入内容,placeholder 中的内容会跟着变化。

因为把ng-model 拼错了,所以显示的结果中, 文本内容改变了,p的内容没有跟着有相应变化,找了好久没找出原因,原来是ng-model拼错,无语。

<html ng-app = "myApp">
<head>
</head>
<body ng-controller='TextController'>
    <input ng-model='greeting' type="text">
    <p ng-bind ='greeting'></p>
    <script src="angular.js"></script>
    
    <script>
    var myAppModule = angular.module("myApp",[]);
    myAppModule.controller('TextController',
        function($scope){
            $scope.greeting =  'Hello World';
    });
    </script>
</body>
</html>

原文地址:https://www.cnblogs.com/recordlife/p/4250431.html