Skip to content

Commit

Permalink
step-1 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Sep 12, 2012
1 parent 654f7d7 commit 194a1ee
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" ng-app="myApp">
<html lang="en">
<head>
<meta charset="utf-8">
<title>Directive Demo</title>
Expand All @@ -12,8 +12,17 @@
<script src="js/controllers.js"></script>
<script src="js/filters.js"></script>
<script src="js/directives.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<body ng-controller="Demo">
Name: <input ng-model="name">

<div>
Hello <span ng-bind="name"></span>
</div>

<ul>
<li ng-repeat="i in [1,2,3]">{{i}}</li>
</ul>
</body>
</html>
19 changes: 19 additions & 0 deletions app/js/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
window.onload = function() {
var $rootElement = angular.element(window.document);
var modules = [
'ng',
'myApp',
function($provide) {
$provide.value('$rootElement', $rootElement)
}
];
var $injector = angular.injector(modules);

var $compile = $injector.get('$compile');
var compositeLinkFn = $compile($rootElement);

var $rootScope = $injector.get('$rootScope');
compositeLinkFn($rootScope);

$rootScope.$apply();
}
1 change: 1 addition & 0 deletions app/js/controllers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';

myApp.controller('Demo', function($scope) {
$scope.name = 'world';
});

0 comments on commit 194a1ee

Please sign in to comment.