【发布时间】:2016-06-15 06:17:00
【问题描述】:
我有一个弹出框,根据语法一切都很好,但是我收到这个错误“$ionicPopover.fromTemplateUrl 不是函数”,如何解决这个问题?
我的控制器:
$ionicPopover.fromTemplateUrl('templates/namespaceSettingPopover1.html', {
scope: $scope,
}).then(function(popover) {
$scope.popover = popover;
});
$scope.openSettings = function($event) {
$scope.popover.show($event);
};
$scope.closeSettings = function() {
$scope.popover.hide();
};
// Execute action on hide popover
$scope.$on('popover.hidden', function() {
// Execute action
});
html:
<div class="ion-android-funnel" ng-click="openSettings($event)">
<img src="img/filter.png" class="filterImg" />
</div>
错误:
ionic.bundle.js:19532 TypeError: $ionicPopover.fromTemplateUrl is not a function
at new <anonymous> (CreatorTrackerController.js:46)
at invoke (ionic.bundle.js:12110)
at Object.instantiate (ionic.bundle.js:12118)
at ionic.bundle.js:16387
at self.appendViewElement (ionic.bundle.js:47357)
at Object.render (ionic.bundle.js:45614)
at Object.init (ionic.bundle.js:45534)
at self.render (ionic.bundle.js:47231)
at self.register (ionic.bundle.js:47189)
at updateView (ionic.bundle.js:52439)
【问题讨论】:
-
检查您是否已将
$ionicPopover正确注入控制器?如果您使用数组表示法进行依赖注入,请检查字符串的顺序。
标签: angularjs ionic-framework popover