I have 2 inputs here, one is setting the value using scope and the other is setting the value after the setTimeout, but my problem here is that... it doesn't show the value immediately and I need to click the second input to show the value. Any solution for this?
angular.module('selectExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.firstInput = "click the second input";
$scope.secondInput;
function init(){
setTimeout(function(){
$scope.secondInput = "second input";
}, 1000);
}
init();
}]);
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<div ng-app="selectExample" ng-controller="ExampleController">
<input type="text" ng-model="firstInput"></input>
<input type="text" ng-model="secondInput"></input>
</div>