javascript - Why is the data unbind with modal window? /AngularJS -


can tell me. want let reflect input data in modal window , parent window text. it's not reflected making modal window. how reflected?

html

<p><img src="***.jpg" alt="" ng-click="cover.show()"></p> <p class="binding-field" id="title-box">{{titlebox}}</p>  <script id="templates/input-cover.html" type="text/ng-template"> <ion-modal-view> .......... <ion-content class="input-area">     <form action="">         <label class="item item-input item-stacked-label">             <input type="text" placeholder="title" ng-model="titlebox">         </label>     </form>  </ion-content>  </ion-modal-view> 

controllers.js

function inputctrl($scope, $ionicmodal) { $ionicmodal.fromtemplateurl('templates/input-cover.html', {     scope: $scope }).then(function(modal) {     $scope.cover = modal; }); }; 

you should pass parent scope via resolve function. doc

example:

code in parentctrl:

var toedit = $scope.model.selectedservers[0];  var modalinstance = $modal.open({     templateurl: 'servers/templates/servers-new.tpl.html',     controller: 'newserverctrl',     resolve: { // sould pass here         serverdata: function () {             return toedit;          }     } }); 

code in childctrl:

 $scope.newserver = serverdata || { os: 2 }; // serverdata passed parentctrl 

hope helps!

just find example on plnkr.

plnkr


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -