Posted in Javascript onJanuary 23, 2015
angularjs遵循MVC模式,惯例来一个hello world吧
<html ng-app> <head> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="controllers.js"></script> </head> <body> <div ng-controller='HelloController'> <p>{{greeting.text}}, world</p> </div> </body> </html>
controllers.js中的内容
function HelloController($scope) { $scope.greeting = { text: "Hello"}; }
MVC写起来很不错的感觉~~
使用angular写一个hello world
- Author -
hebedich声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@