The {{name}}
outside the jquery-steps div
can be updated, but not the {{name}}
inside. Why and how to fixed this? Please see my code or jsfiddle.
HTML
<div ng-controller="MyCtrl">
Hello, {{name}}!
<div id="example-basic">
<h3>Keyboard</h3>
<section>
<p>I'm {{name}}</p>
</section>
<h3>Effects</h3>
<section>
<p>I'm {{name}}</p>
</section>
</div>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.name = 'Superhero';
$("#example-basic").steps({
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
autoFocus: true,
onStepChanging: function(e, currentIndex, newIndex){
setTimeout(function(){ // Time out included, otherwise throw error.
$scope.$apply(function(){
$scope.name = 'NEWNAME!'
console.log($scope.name)// both console and {{name}} outside the #example-basic is updated, but not inside. PROBLEM!
},10)
})
return true;
}
});