Ashish Ranjan Ashish Ranjan - 5 months ago 28
AngularJS Question

How to use ng-bind for my model?

From the documentation, its clear, with ng-bind we can update our HTML, How to use the same functionality for updating my model.

<input type="text" ng-bind="">

I don't want to use ng-model, Don't want to reflect changes in my input box when data is fetched from the backend.


If you don't want two-way data binding, I assume that you will process all the data at once (perhaps on a button click). The way I would do it is by creating a temporary scope variable to assign using ng-model, and then assigning it to the original variable on button click.

<input type="text" ng-bind="">
<button ng-click="submit()">Save</button>

$scope.model = updateViaBackend();
$scope.temp = { property: "" };

$scope.submit = function(){
  $ = $;