Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Only call console.log when available #14047

Merged
merged 2 commits into from
Feb 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/angular.bind.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
if (window.angular.bootstrap) {
//AngularJS is already loaded, so we can return here...
console.log('WARNING: Tried to load angular more than once.');
if (window.console) {
console.log('WARNING: Tried to load angular more than once.');
}
return;
}

Expand Down
10 changes: 10 additions & 0 deletions test/e2e/fixtures/angular-already-loaded/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html ng-app="test">
<div ng-controller="TestCtrl">
<p>{{text}}</p>
</div>

<script src="angular.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
</html>
4 changes: 4 additions & 0 deletions test/e2e/fixtures/angular-already-loaded/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
angular.module("test", []).
controller("TestCtrl", function($scope) {
$scope.text = "Hello, world!";
});
10 changes: 10 additions & 0 deletions test/e2e/tests/angular-already-loadedSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe('App where angular is loaded more than once', function() {
beforeEach(function() {
loadFixture("angular-already-loaded").andWaitForAngular();
});

it('should have the interpolated text', function() {
expect(element(by.binding('text')).getText())
.toBe('Hello, world!');
});
});