Skip to content

Commit

Permalink
WIP: potiential fix for wrozka#4
Browse files Browse the repository at this point in the history
Add lookup for attributes derivated of ng-app: data-ng-app and x-ng-app.
  • Loading branch information
Thomas Wickham committed Nov 8, 2013
1 parent ba97d2b commit bf2e6e1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/capybara/angular/waiter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ def angular_app?
def setup_ready
page.execute_script <<-JS
window.angularReady = false;
var app = $('*[ng-app]');
var injector = app.injector();
var roots = ['ng-app', 'data-ng-app', 'x-ng-app'];
var injector = (roots
.map(function(e) { angular.element(e).injector(); })
.filter(angular.isFunction))[0]
if (!injector)
throw new Error("Can't find any Angular Root ! I've looked for: " + roots);
injector.invoke(function($browser) {
$browser.notifyWhenNoOutstandingRequests(function() {
Expand Down

0 comments on commit bf2e6e1

Please sign in to comment.