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
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:
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Mar 1, 2015 at 20:14 OndrajZOndrajZ 4674 silver badges19 bronze badges 2Chrome: 36.0.1985.125
Angular.js: 1.3.14
- Seems to be working fine here: jsfiddle/g33ct2ah Are there no errors in the console? – JLRishe Commented Mar 1, 2015 at 20:19
- No, there are no errors in javascript console. – OndrajZ Commented Mar 1, 2015 at 20:23
1 Answer
Reset to default 14Problem 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.