Created
December 23, 2013 09:04
-
-
Save jexchan/8093767 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html id="ng-app" ng-app="app"> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script> | |
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" /> | |
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" /> | |
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body ng-controller="mainCtrl"> | |
<div class="alert">{{test}}</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//best practice: id="ng-app" 用来解决浏览器兼容问题 | |
//best practice: 注入$scope时最好用现在的数组方式加入 | |
angular.module("app", []) | |
.controller("mainCtrl", ["$scope", function($scope) { | |
$scope.test="hello"; | |
}]); | |
//如果在页面未用 ng-app ,可以手动来声明,但可能带来兼容性上的问题 | |
angular.bootstrap(document.body, ["app"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment