AngularJS hello world

AngularJS 是一个 JavaScript 框架。它可通过 <script> 标签添加到 HTML 页面。

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.js"></script>

 

hello world 例子

<!DOCTYPE html>
<html ng-app="myapp" ng-controller="hello">
<head>
    <meta charset="utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.js"></script>
</head>
<body>
<div>
    <h1>Hello {{name}}</h1>
</div>
<script>
    var app = angular.module('myapp',[]);
    app.controller('hello',function($scope)
    {
        $scope.name='world';
    });
</script>
</body>
</html>

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: