change bootstrap to angular.compile

This commit is contained in:
Misko Hevery
2010-01-09 13:43:16 -08:00
parent eb9e66f480
commit 88eca572fd
3 changed files with 5 additions and 12 deletions

View File

@@ -4,7 +4,6 @@
<script type="text/javascript" src="../angular.js#autoBind=false"></script>
<script type="text/javascript">
$(document).ready(function(){
var angular = angularFactory({});
var scope = angular.compile(document);
scope.set('a', 3);
scope.updateView();

View File

@@ -387,19 +387,15 @@ nglr.UrlWatcher.prototype.getUrl = function() {
return window.location.href;
};
window['angularFactory'] = function(config) {
angular['compile'] = function(root, config) {
config = config || {};
var defaults = {
server: ""
};
//todo: don't load stylesheet by default
//todo: don't start watcher
function compile(root){
var loader = new nglr.Loader(root, jQuery("head"), _(defaults).extend(config));
loader.load();
return jQuery(root).scope();
};
return {
compile:compile
};
var loader = new nglr.Loader(root, jQuery("head"), _(defaults).extend(config));
loader.load();
return jQuery(root).scope();
};

View File

@@ -3,8 +3,6 @@ ExternalApiTest = TestCase("ExternalApiTest");
ExternalApiTest.prototype = {
testItShouldExposefactory:function(){
var node = $('<div ng-init="a=1">{{b=a+1}}</div>')[0];
var settings = {};
var angular = angularFactory(settings);
var scope = angular.compile(node);
assertEquals(1, scope.get('a'));
assertEquals(2, scope.get('b'));