ngRepeat不AngularUI引导对话框内工作 [英] ngRepeat does not work inside AngularUI bootstrap dialog

查看:100
本文介绍了ngRepeat不AngularUI引导对话框内工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有人知道如何让我的code工作。我试图让用户创建对话框,并希望利用发送后ngResource数据,我已经配置了我的PHP后台和工作预期。现在,我的问题是追加对话框上的错误,我已经试过加入伪数据,但ngRepeat不为我工作。我也试着调试问题不同的步骤,但没有为我工作。我也研究有关问题,但没有运气。这里是我的code:

does anyone know how to get my code working. I'm trying to make a user creation dialog and want to send post data using ngResource, I've already configured my PHP backend and its working as expected. Now, my problem is appending errors on the dialog, I've tried adding dummy data but ngRepeat does not work for me. I've also tried different steps debugging the problem but nothing works for me. I've also researching about the issue but no luck. here is my code:

<div name="errors" id="errors" class="alert alert-error">
        <li ng-repeat="error in dialog.errors">{{ error }}</li>
</div>

尝试看看链接
http://jsfiddle.net/QCQrF/

推荐答案

@Ryan有东西在你的jsfiddle回事号码,但最重要的问题是你指定对话框的模板的方式。模板可以是指定为字符串(使用模板属性)或部分( templateUrl )。

@Ryan there were number of things going on in your jsFiddle but the most important problem was the way you were specifying dialog's template. A template can be either specify as string (using the template property) or as a partial (templateUrl).

如果您移动模板的部分,你可以像如下指定它:

If you move a template to a partial you can specify it like follows:

var dialogOpts = {
        backdrop: true,
        keyboard: true,
        backdropFade: true,
        backdropClick: true,
        templateUrl:  'login-dialog.html',
        controller: 'DialogCtrl',
        resolve: { dialogScope : {
          errors : ['error1', 'error2'],
          title :'Add User',
          btnTxt : 'Create User'
        }}
    };

此外,国际海事组织很容易将数据传递给被使用决心属性,而不是使用对话框的实例,在对话框的范围内公开。

Also, IMO it is easier to pass data to be exposed on the dialog's scope using the resolve property instead of using dialog's instance.

我已经转换你的小提琴一个普拉克表明这一点:<一href=\"http://plnkr.co/edit/iGIwPBj9zBPgX3IUwBNj?p=$p$pview\">http://plnkr.co/edit/iGIwPBj9zBPgX3IUwBNj?p=$p$pview

I've converted your fiddle to a plunk to show this: http://plnkr.co/edit/iGIwPBj9zBPgX3IUwBNj?p=preview

您可能会发现$对话框的服务附加文件中该服务的进一步exploaration有所帮助:<一href=\"https://github.com/angular-ui/bootstrap/blob/master/src/dialog/README.md\">https://github.com/angular-ui/bootstrap/blob/master/src/dialog/README.md

You might find $dialog's service additional documentation helpful in further exploaration of this service: https://github.com/angular-ui/bootstrap/blob/master/src/dialog/README.md

随着最后一句话,我注意到你正在被传递 $事件参数的事件处理程序(所有调用 preventDefault ()对他们的),而这是不必要的。

As the last remark, I've noticed that you are were passing the $event argument to event handlers (all calling preventDefault() on them) while this is unnecessary.

这篇关于ngRepeat不AngularUI引导对话框内工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆