7

Problem:

I started using angular.js for my project and during development I noticed that controller sometimes doesn't load, so I tried removing parts of the project until the smallest possible example but the problem still remains.

Code:

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Test</title>
</head>
<body ng-app="myApp">
    <div ng-controller="TestController">
        <input ng-model="testText" type="text" placeholder="Enter text">
    </div>
    <script src="/static/js/angular.js"></script>
    <script src="/static/js/app.js"></script>
</body>
</html>

app.js

console.log("INIT");
angular.module('myApp', [])
.controller('TestController', ['$scope', function($scope) {
    $scope.testText = '172.17.2.1';
    console.log("SCOPE");
}]);

Note:

"INIT" part always gets displayed in console. Altough "SCOPE" part sometimes (or most of the time) doesn't so the input field doesn't get filled.

Versions:

Chrome: 36.0.1985.125

Angular.js: 1.3.14

2
  • Seems to be working fine here: jsfiddle.net/g33ct2ah Are there no errors in the console? Commented Mar 1, 2015 at 20:19
  • No, there are no errors in javascript console. Commented Mar 1, 2015 at 20:23

1 Answer 1

14

Problem was "AngularJS Batarang" extension for Chrome. It was somehow messing up with the angular. I never actually used it, installed it sometime ago when researching angular.js and forgot it enabled.

I disabled it and everything works fine.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for this. Was just driving myself batty trying to figure out why my views would intermittently not load. Disabled Batarang and everything works as it should have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.