How does data binding work in AngularJS?

前端 未结 14 1935
情话喂你
情话喂你 2020-11-21 05:41

How does data binding work in the AngularJS framework?

I haven\'t found technical details on their site. It\'s more or less clear how it works when data

14条回答
  •  轮回少年
    2020-11-21 05:59

    It happened that I needed to link a data model of a person with a form, what I did was a direct mapping of the data with the form.

    For example if the model had something like:

    $scope.model.people.name
    

    The control input of the form:

    
    

    That way if you modify the value of the object controller, this will be reflected automatically in the view.

    An example where I passed the model is updated from server data is when you ask for a zip code and zip code based on written loads a list of colonies and cities associated with that view, and by default set the first value with the user. And this I worked very well, what does happen, is that angularJS sometimes takes a few seconds to refresh the model, to do this you can put a spinner while displaying the data.

提交回复
热议问题