我是新来的离子和努力就button.Following的点击打开警报打开警报是代码片段我使用:上的点击按钮离子
<button class="button button-dark" ng-click="showAlert()">Sample Alert</button>
在controller.js
.controller('PopupCtrl', function($scope, $timeout, $q, $ionicPopup) {
$scope.showAlert = function() {
var alertPopup = $ionicPopup.alert({
title: 'Don\'t eat that!',
template: 'It might taste good'
});
alertPopup.then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
};
})
我已经通过:First steps with ionic to get popup alert on button tap/click但是,没有什么帮助。我做错了什么?
而且,它给了我以下错误:
Error: $ionicPopup is not defined
[email protected]://localhost:8100/js/controllers.js:20:13
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:21044:15
@http://localhost:8100/lib/ionic/js/ionic.bundle.js:53458:9
$RootScopeProvider/this.$get</[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:23100:16
$RootScopeProvider/this.$get</[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:23199:18
@http://localhost:8100/lib/ionic/js/ionic.bundle.js:53457:7
createEventHandler/[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:11713:9
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:2863:3
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:2852:3
[email protected]://localhost:8100/lib/ionic/js/ionic.bundle.js:2925:5
return logFn.apply(console, args);
我是否需要在app.js的东西吗?
通常你的控制器看起来很好,我可以看看你的代码的其余部分? –