EDIT The code is correct, the problem is with the inclusion of "ngTouch", see my own answer below.
I’m probably making some kind of stupid mistake, but for life I can’t find me. I have this piece of markup that is correctly connected to the controller:
<input type="text" ng-change="doStuff()" ng-model="stuff"/> <button ng-click="doStuff()">doStuff</button>
Controller Code:
console.log('Hi from controller'); $scope.stuff = "something"; $scope.doStuff = function() { alert('doing stuff'); }
The problem does not occur when I press the button. If I change the input field, I get a warning, so ng-change works, but ng-click does not work. Let me know if this is not enough, but I don’t know what else needs to be provided, and the general setup seems to work fine ...
The rest of the HTML does not contain any Angular directives, and it loads like this in myModule.config:
$stateProvider .state('stuff', { templateUrl: 'pages/stuff.html', url: '/stuff', controller: 'StuffCtrl' })
and the controller is defined as follows:
angular.module('myModule') .controller('StuffCtrl', function ($scope) {
source share