angularjs - The most Angular-y way of pre-loading data into $scope -


The part of my application is a complete AJAX and some traditional posts are reloaded. Receiving data in $ scope is a trivial task using $ http , but what happens when data is available for the template during page load (General MVC The way in which everyone knows the fact after using AJAX?

Consider the following part of the code:

  
ng-repeat = "address Address "& gt; {{address.address1}} {{address.city}}, {{address.state}} {{address.zip}}

I generate 100 dynamic in $ scope.addresses without using AJAX How to go about loading the address?

"post-text" itemprop = "text">

For your "inline" controller, The easiest way to use the input will be:

  @Model SampleViewModel ... & lt; div ng-controller = "SampleCtrl" ng-init = "adresses =@Model.AdressesList" Another approach is displayed:  
  & lt; script> function SampleCtrl ($ scope) {$ scope.adresses = @ Html.Raw (Jason. Encode (model)); ...} & lt; / Script & gt; & Lt; Div ng-controller = "SampleCtrl" ng-repeat = "address address" & gt;  

Comments

Popular posts from this blog

sql - Find last match with latest inserted name in table -

c# - XML serialize base class without knowing derived class -

ios - Invalid IPA: missing embedded provisioning profile. Are you sure this is an ad hoc? -