I'm getting the Tried to load angular more than once
warning only when I load the page initially.
Due to this warning, my bindings don't seem to work. But when I reload the page, I don't get the warning and everything seems to bind and work correctly.
I'm not using any routes or ui-view! (I've seen the other SO posts and I don't think they apply to my case).
I double checked and made sure that I only have Angular JS referenced once. My usage of Angular JS is really simple at this point.
I have Angular JS referenced in the layout / the master page in this order -
jquery
jquery-ujs // Rails Unobtrusive jQuery Adapter
jquery-ui
angular
foundation // ZURB Foundation 6
turbolinks // Rails Turbolinks
Here is how my Angular template looks like -
<body ng-app="test">
<div ng-controller="TestController">
<div ng-init="items = <%= items.to_json %>">
<div ng-repeat="item in items">
<p ng-bind="item"></p>
</div>
</div>
</div>
</body>
items
is a Rails object and I basically hand it off to Angular for the initial load.
Here is what I have in the Javascript in my Layout page -
var app = angular.module('test', []);
Here is what I have in the Javascript for the View / Content page -
app.controller('TestController', ['$scope', '$http', '$compile', function($scope, $http, $compile){
// Some Functions
}]);
Any help would be greatly appreciated!
Note: The Tried to load angular more than once
warning shows up for every page I visit unless I reload the page and I don't get the warning and the bindings seem to work correctly.
Here is a screenshot, after visiting 4 pages without reloading any of them -
Once I reload a page, I don't get the warning and the bindings work correctly.