2015-11-30 49 views
0

所以我尝试了一切,每一个例子,我绝对不知道什么是错的。每当我尝试加载'$ uibModal'时,我都会收到错误,并且我所有的角码都会中断。如果我没有正确加载它,那么我得到$ uibModal.open错误。这是我的代码。我目前的版本是0.14.3,我今天刚刚下载了这个文件。如果它很重要我的角应用程序是在轨道和即时通讯使用鲍尔导入一切。

我在我的js中加载的app.js文件。

var app = angular.module('planoxApp', 
['ui.router', 
'nya.bootstrap.select', // bootstrap select 
'ngAnimate', 
'ui.bootstrap', 
'main-directives',  
'templates', 
'color.picker', 
'xeditable', 
'restangular', 
'ngDragDrop', 
'angularFileUpload', 
'ngStorage' 

// 'mgcrea.ngStrap', 
// 'mgcrea.ngStrap.typeahead', 
// 'mgcrea.ngStrap.tooltip', 
// 'mgcrea.ngStrap.helpers.parseOptions', 

]) 

的CTRL装载区域,这带来了错误

[$注射器:unpr]未知提供商:$ uibModalProvider < - $ uibModal < - PhotoplanCtrl

app.controller('PhotoplanCtrl',['$http','$scope','$stateParams','$filter','$uibModal','$log', 
function($http,$scope, $stateParams,$filter,$uibModal,$log){ 

但如果我改变它也是

app.controller('PhotoplanCtrl',['$http','$scope','$stateParams','$filter','$log', 
function($http,$scope, $stateParams,$filter,$uibModal,$log){ 

错误消失了,在取而代之,我们得到,错误:$ uibModal.open不是一个函数。 (在 '$ uibModal.open', '$ uibModal.open' 是不确定的)

这里是模态码

var modalInstance = $uibModal.open({ 
    animation: $scope.animationsEnabled, 
    templateUrl: 'templates/photoplan/ModalPublish.html', 
    controller: 'ModalPublishCtrl' 
}); 

如果有人知道什么是错,任何帮助非常感谢。

+0

这似乎工作:http://plnkr.co/edit/MdQirCdgrkrUYjybtjRo?p=preview –

+1

你确定ui.bootstrap是在你的index.html加载吗? 第二个错误是红鲱鱼。因为您从依赖数组中删除了$ uibModal,所以Angular实际上在您的代码需要$ uibModal的地方注入$ log。 –

+0

所以我想在下面做一个更详细的评论。但JC在正确的轨道上。我使用了Andy W plunker中的链接,并将它们插入到application.html.erb文件中,基本上是index.html,现在它正在工作。所以显然它没有正确加载到index.html文件中。我认为它可能会在引导之前加载。所以我即将重新审视,然后发布后续评论/回答 –

回答

0

好吧,首先,我的模态HTML你不能有NG控制器。显然引导程序处理它,所以我的新的HTML看起来像。

<div class="modal-header" > 
      <h3 class="modal-title">Account Settings</h3> 
     </div> 
     <div class="modal-body"> 
      <ul> 
       <li> 
        <p>An option to chage password and account username </p> 
        <p>An option to change time settings </p> 
        <p> </p> 
       </li> 
      </ul> 
     </div> 
     <div class="modal-footer"> 
      <button class="btn btn-warning" type="button" ng-click="cancel()">Close</button> 
     </div> 

也出于某种原因,它不正确加载或者在我的导轨管道或角度,这是非常奇怪的。我可能会在github上报告该问题,但除此之外,我只是将CDN添加到我的index.html文件中,并开始正常工作。

相关问题