Why my controller executes twice ?
I made many tests and it returns the same result, it can impact my application ?
<html ng-app="todoApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
<script>
"use strict";
angular.module('todoApp', [])
.controller('TodoListController', function() {
var todoList = this;
var i = 0;
todoList.addTodo = function() {
console.log(1)
i++;
// return i it breaks the script
};
});
</script>
</head>
<body ng-controller="TodoListController as todoList">
{{todoList.addTodo()}}
</body>
</html>