按下按钮时,ng点击不起作用
ng-click not working when button is pushed
我正试图在单击按钮时执行一个函数。。。
这是我的按钮:
<body ng-app="starter">
<div ng-controller="convertController">
<button class="button button-block button-balanced" ng-click="convert()">
Convert
</button>
</div>
这是我的功能:
var myApp = angular.module('starter',['ionic']);
myApp.controller('convertController', ['$scope', function($scope) {
$scope.convert = function(){
alert("convert");
}
}]);
为什么当我点击按钮时,函数没有被调用?
这段代码很好,它应该可以像您在下面的代码片段中看到的那样工作,这是代码的复制粘贴(ionic
依赖项除外)。
这个问题可能来自其他地方。请检查您的控制台是否有任何错误,Angular可能由于其他原因无法启动(例如无法解决离子依赖关系?)。
如何使用Chrome 查看错误
如何使用Firefox 查看错误
var myApp = angular.module('starter',[]);
myApp.controller('convertController', ['$scope', function($scope) {
$scope.convert = function(){
alert("convert");
}
}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="starter">
<div ng-controller="convertController">
<button class="button button-block button-balanced" ng-click="convert()">
Convert
</button>
</div>
</body>
相关文章:
- 角度ng变化或ng点击选择can'不起作用
- AngularJS ng include dons'不起作用
- ng disabled在chrome中不起作用.按钮在角度上未禁用
- 角度无线电按钮ng模型不起作用
- Angular js+ng repeat+字母数字索引不起作用
- 角度Js ng-disabled不起作用
- AngularJS ng include won'不知什么原因不起作用
- 角度过滤器和ng点击不起作用
- 初始化ng模型时,Angular ui选择占位符不起作用
- 角度去抖动(ng模型选项)不起作用
- angularjs ng点击运行时标记不起作用
- Ng点击don´不起作用
- 为什么ng节目不起作用
- 带有粘性标题的角度ng视图不起作用
- select中布尔值的Angularjs ng值不起作用
- ng模型在$(element).clone()之后不起作用
- AngularJS触发ng更改不起作用
- Angular js-ng选项不起作用
- ng显示“;调用方法“;不起作用
- angular元素在通过ng类添加类时不起作用