在angularjs模式窗口模式是空的 [英] Model in a modal window in angularjs is empty

查看:100
本文介绍了在angularjs模式窗口模式是空的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我使用 angularjs UI引导和我在一个模式窗口有一个文本字段,这当我尝试打印在警报窗口是​​空的。任何原因?这里是code的 plunker

Hello I am using angularjs ui bootstrap and I have one text field in a modal window, which when I try to print it in alert window it is empty. Any reasons why? Here is a plunker of the code.

推荐答案

尝试改变


  • $ scope.testField

  • $scope.testField


  • $ scope.myModel.testField (或 user.firstName ...)

  • $scope.myModel.testField (or user.firstName...)

在本视频中提到的角JS - 最佳实践(29:19):

As mentioned in this video angular JS - best practice (29:19):

每当你有NG-模型有一定有在某处有一个点,如果你没有一个点,你这样做是不对的。

"Whenever you have ng-model there's gotta be a dot in there somewhere. If you don't have a dot, you're doing it wrong."

请参阅更新plunker http://plnkr.co/edit/z1ABPEUB7Nxm1Kxey9iv?p= preVIEW

See updated plunker http://plnkr.co/edit/z1ABPEUB7Nxm1Kxey9iv?p=preview

请注意:从文章的嵌套的范围在角JS

这篇关于在angularjs模式窗口模式是空的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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