Css Ui-bootstrap-tpls-0.13和bootstrap 3.3.2、angular 1.3.14的Ui引导模式不工作
如标题中所述,模态没有显示。 表单的内容是通过formly加载的,模板的内容似乎是加载的,但它只显示非常薄的模式,覆盖但不显示内容 我有一个主控制器,其中我有:Css Ui-bootstrap-tpls-0.13和bootstrap 3.3.2、angular 1.3.14的Ui引导模式不工作,css,angularjs,twitter-bootstrap,angular-ui-bootstrap,angular-formly,Css,Angularjs,Twitter Bootstrap,Angular Ui Bootstrap,Angular Formly,如标题中所述,模态没有显示。 表单的内容是通过formly加载的,模板的内容似乎是加载的,但它只显示非常薄的模式,覆盖但不显示内容 我有一个主控制器,其中我有: $scope.add = function(){ $modal.open({ templateUrl: 'app/js/templates/popupAddCarForm.html', controller: 'FormsController', c
$scope.add = function(){
$modal.open({
templateUrl: 'app/js/templates/popupAddCarForm.html',
controller: 'FormsController',
controllerAs: 'vm',
backdrop: 'static',
resolve: {
formData: function(){
return {
fields: getFormFields(),
model: {}
}
}
}
});
};
我的html是这样的:
<script type="text/ng-template" id="popupAddCarForm">
<div class="modal">
<div class="modal-dialog">
<div class="modal-header">
<h3 class="modal-title">Adauga masina</h3>
</div>
<div class="modal-body">
<form name="vm.addCarForm">
<formly-form model="vm.formData.model" fields="vm.formData.fields">
</formly-form>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="submit" >Adauga</button>
</div>
</div>
</div>
结果是这样的:
<script type="text/ng-template" id="popupAddCarForm">
<div class="modal">
<div class="modal-dialog">
<div class="modal-header">
<h3 class="modal-title">Adauga masina</h3>
</div>
<div class="modal-body">
<form name="vm.addCarForm">
<formly-form model="vm.formData.model" fields="vm.formData.fields">
</formly-form>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="submit" >Adauga</button>
</div>
</div>
</div>
稍后编辑:
为了消除我们自己的其他疑虑,以下是演示中的代码:
app.controller('ModalInstanceCtrl', function ($modalInstance, formData) {
var vm = this;
debugger;
// function assignment
vm.ok = ok;
vm.cancel = cancel;
// variable assignment
vm.formData = formData;
vm.originalFields = angular.copy(vm.formData.fields);
// function definition
function ok() {
$modalInstance.close(vm.formData.model);
}
function cancel() {
$modalInstance.dismiss('cancel');
};
}))
链接:angular formly.com/#/example/integrations/ui bootstrap modal
稍后,稍后编辑:
普朗克:
文件夹结构:
--app
----js
------controller
------services
------templates
------view
----app.js
intex.html
我的popupAddCarForm.html位于templates目录中,但正如您在plunker中看到的,它不会呈现我加载的内容,即使是在同一目录中,尽管是一个单独的模板文件。模式模板不需要有模式和模式对话框层-它们将通过引导生成
<script type="text/ng-template" id="popupAddCarForm.html">
<div class="modal-header">test
<h3 class="modal-title">Adauga masina</h3>
</div>
<div class="modal-body">
<form name="vm.addCarForm">
<formly-form model="vm.formData.model" fields="vm.formData.fields">
</formly-form>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="submit" >Adauga</button>
</div>
</script>
测试
阿杜加马西纳酒店
阿杜加
你看过哪个版本会这样吗?@KentcdLobbs:check Edits看起来不像是两个版本的组合:。可能会制作一个Plunker、CodePen、JSBin或类似的程序,重现问题,以便其他人可以帮助调试所发生的事情。@jme11:正确制作Plunker吗now@jme11:添加了提示,您需要在templateUrl中匹配模板id。