使用angular写一个hello world

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写起来很不错的感觉~~