= AngularJS =
== Examples ==
{{{#!highlight html
Todo
{{testx()}}
{{todoList.valuesX}}
{{selectedOption}}
}}}
{{{#!highlight javascript
var app = angular.module('todoApp', []);
app.controller('TodoListController', TodoListController );
function TodoListController($scope,$timeout,$interval,$http) {
console.log('Called TodoListController');
this.valuesX=[];
this.listDisabled=true;
this.scope = $scope;
this.scope.selectedOption='';
this.scope.testx = this.testx;
$timeout(this.fillValues.bind(this),5000);
$interval(function () { console.log('$interval kkkk llll ' + new Date() );},10000);
$http.get('todo.js').then(function(response) {
console.log( response.data );
});
}
TodoListController.prototype.testx=function(){
return "ASDF";
};
TodoListController.prototype.fillValues=function(){
console.log('called fill values');
this.valuesX=['aa','bb','cc'];
this.listDisabled=false;
this.scope.selectedOption='bb'; //select default value
// when calling with $timeout $apply is not needed
//this.scope.$apply();
};
TodoListController.prototype.change=function(){
console.log('change');
console.log( JSON.stringify(this.valuesX) );
console.log( this.scope.selectedOption );
}
}}}