我有一个导航按钮应该表现出酥料饼离子酥料饼,类型错误:无法读取属性“秀”
<ion-nav-buttons side="secondary">
<button class="button button-icon icon ion-more" ng-click="openPopover($event)"></button>
</ion-nav-buttons>
,这是控制器
.controller('MyController', ['$scope','$ionicPopover', function($scope, $ionicPopover) {
$ionicPopover.fromTemplateUrl('popover.html', {
scope: $scope
}).then(function(popover) {
$scope.popover = popover;
});
$scope.openPopover = function($event) {
$scope.popover.show($event);
};
$scope.closePopover = function() {
$scope.popover.hide();
};
$scope.$on('$destroy', function() {
$scope.popover.remove();
});
}])
,但是当我点击导航按钮我面对TypeError: Cannot read property 'show' of undefined at Scope.$scope.openPopover
这里是我在同一个项目文件夹中的模板
<ion-popover-view>
<ion-content>
<div class="list">
<label class="item item-input" ng-click="addFavorite(dish.id)">
<div class="input-label">
Add To Favorites
</div>
</label>
<label class="item item-input" ng-click="openModal()">
<div class="input-label">
Add A Comment
</div>
</label>
</div>
</ion-content>
</ion-popover-view>
是否允许popover正确返回?你的模板是否正确? – tpsilva
@tpsilva你能解释更多关于承诺吗?我应该如何检查popver是否正确?该模板是正确的(由官方文档提供的模板) –
但是,你有源文件夹中的模板? – tpsilva