Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 views
in Technique[技术] by (71.8m points)

Model in a modal window in angularjs is empty

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here is an updated plunker for you: http://plnkr.co/edit/tvE4DoovZ6NheYj1HMho?p=preview

When using the modal service with ui-bootstrap, you need to encapsulate your model in a container scope, eg:

$scope.form = { testValue: '' };

Also read this for more information about nested scopes: http://jimhoskins.com/2012/12/14/nested-scopes-in-angularjs.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...