diff options
| author | Misko Hevery | 2010-01-18 17:56:08 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2010-01-18 17:56:08 -0800 | 
| commit | 0e566fe6cb41de388df6793b350fb81aaa4a8476 (patch) | |
| tree | dc526a2a5de174f820ef375ffcdb45e32de9cda7 /src/Angular.js | |
| parent | 7b558b5382c864b00392f50fa5095e53f7b486d0 (diff) | |
| download | angular.js-0e566fe6cb41de388df6793b350fb81aaa4a8476.tar.bz2 | |
tweeter demo client
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 30 | 
1 files changed, 16 insertions, 14 deletions
diff --git a/src/Angular.js b/src/Angular.js index 69cab0a2..3dc72ff7 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -227,7 +227,7 @@ Angular.prototype = {    bindHtml: function() {      log('Angular.bindHtml()'); -    var watcher = new UrlWatcher(this.location); +    var watcher = this.watcher = new UrlWatcher(this.location);      var document = this.document;      var widgetFactory = new WidgetFactory(this.config.server, this.config.database);      var binder = new Binder(document[0], widgetFactory, watcher, this.config); @@ -285,12 +285,6 @@ Angular.prototype = {      log('$binder.parseAnchor()');      binder.parseAnchor(); -    log('$binder.updateView()'); -    binder.updateView(); -   -    //watcher.listener = bind(binder, binder.onUrlChange, watcher); -    //watcher.onUpdate = function(){alert("update");}; -    //watcher.watch();      document.find("body").show();      log('ready()');    }, @@ -378,12 +372,13 @@ UrlWatcher.prototype = {    },    setUrl: function(url) { -//    var existingURL = window.location.href; -//    if (!existingURL.match(/#/)) -//      existingURL += '#'; -//    if (existingURL != url) -//      window.location.href = url; -//    this.existingURL = url; +    //TODO: conditionaly? +    var existingURL = window.location.href; +    if (!existingURL.match(/#/)) +      existingURL += '#'; +    if (existingURL != url) +      window.location.href = url; +    this.existingURL = url;    },    getUrl: function() { @@ -409,6 +404,13 @@ angular['compile'] = function(root, config) {      'updateView':function(){return scope.updateView();},      'set':function(){return scope.set.apply(scope, arguments);},      'get':function(){return scope.get.apply(scope, arguments);}, -    'init':function(){scope.get('$binder.executeInit')(); scope.updateView();} +    'init':function(){scope.get('$binder.executeInit')(); scope.updateView();}, +    'watchUrl':function(){ +      var binder = scope.get('$binder'); +      var watcher = angular.watcher; +      watcher.listener = bind(binder, binder.onUrlChange, watcher); +      watcher.onUpdate = function(){alert("update");}; +      watcher.watch(); +    }    };  };
\ No newline at end of file  | 
