NgRepeat not working inside AngularUI bootstrap dialog

Does anyone know how to make my code work. I am trying to create a user creation dialog and want to send post data using ngResource, I have already configured my PHP server and its operation as expected. Now my problem is adding errors in the dialog, I tried adding dummy data, but ngRepeat does not work for me. I also tried different steps to debug the problem, but nothing works for me. I am also studying the problem, 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> 

try to see the link http://jsfiddle.net/QCQrF/

+1
source share
1 answer

@Ryan there were a lot of things in your jsFiddle, but the most important issue was how you defined the dialog template. A template can be specified as a string (using the template property) or as partial ( templateUrl ).

If you move the template to partial, you can specify it as 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' }} }; 

In addition, IMO is easier to transfer the data that will be displayed in the dialog area using the resolve property instead of using an instance of the dialog.

I turned your violin into plunk to show this: http://plnkr.co/edit/iGIwPBj9zBPgX3IUwBNj?p=preview

You may need additional documentation with additional documents in the $ dialog for further operation of this service: https://github.com/angular-ui/bootstrap/blob/master/src/dialog/README.md

As a final note, I noticed that you passed the $event argument $event handlers (all calling preventDefault() on them), while this is not necessary.

+6
source

All Articles