我是新來的離子和努力就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的東西嗎?
通常你的控制器看起來很好,我可以看看你的代碼的其餘部分? –