Francis Empleo Francis Empleo - 1 month ago 36
AngularJS Question

NgBootbox with two way binding template not working

i have here an input button where i want to set its message using a template.At first, when i clicked the button it should run a function which will set scope.info value to info, and then the modal should popup containing the template which has the two way binding. but the binding is not working

Code:

index.html
<input
type="button"
name="name"
value="New"
ng-click="verify()"
ng-bootbox-title="Warning"
ng-bootbox-custom-dialog
ng-bootbox-custom-dialog-template="temp.html"
ng-bootbox-buttons="customDialogButtons"
ng-bootbox-class-name="some-class" />

temp.html
<div>{{info}}</div>

prog.js
$scope.verify = function(){
$scope.infos= "info";
};

SOLVED!

SOLUTION:
prog.js
$scope.verify = function(){
$rootScope.infos= "info";
};

Answer

Your code works correctly, you just miss spelled the name of your variable ({{infos}}) in your div.

JSFiddle working.


Update from comments

Try to put infos value in $rootScope instead of $scope, it seems you have an issue of accessibility.