I know that you can initailise values from an angular controller in a div like this: View:
<div ng-controller="SimpleController">
<ul>
<li ng-repeat="cust in customers">
{{cust.name}} - {{cust.city}}
</li>
</ul>
</div>
Controller:
function SimpleController($scope) {
$scope.customers = [
{ name: 'Jane', city: 'New York' },
{ name: 'John', city: 'Chicago', }
];
}
But lets say that i want to get the data from a controller (that maybe fetches data from a db) and receive its value in $scope.customers?
Have a look at this method:
public ? PassThisToAngular()
{
var customer = new List<Customer>()
{
new Customer() {Name = "Pauly-D", City = "New Jersey"},
new Customer() {Name = "Snooki", City = "New Jersey"}
};
return ?
}
Can I call this method from my angular-controller and store its values in @scope.customers? Thank you!