Model in a modal window in angularjs is empty

前端 未结 2 1656
耶瑟儿~
耶瑟儿~ 2020-11-30 15:32

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 plu

2条回答
  •  醉酒成梦
    2020-11-30 16:07

    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

提交回复
热议问题