Hi sander,
First I want to say thanks for given me your valuable time and suggestion.
I send you a my webservice code and Angularjs code. Please find it .
My webservice gives me output as i expect. I test it in other .Net project
it work fine .
webservice code --
[WebMethod]
public string Employees()
{
SqlDataReader ds = dl.getemployees();
List<Company> l1 = new List<Company>();
while(ds.Read())
{
Company c1 = new Company();
c1.cardname = ds["cardname"].ToString();
l1.Add(c1);
}
string json = new
System.Web.Script.Serialization.JavaScriptSerializer().Serialize(l1);
return json;
}
public SqlDataReader getemployees()
{
SqlConnection conn = new SqlConnection("Data
Source=INFXIT-02124;Initial Catalog=AcupackAug;User ID=sa;Password=tispl");
conn.Open();
SqlCommand cmd = new SqlCommand("TISEMP", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader ds1;
ds1 =cmd.ExecuteReader();
return ds1;
}
Web service Output is like
[{"name":"Cipla Ltd."},
{"name":"Aurobindo Pharma Ltd"}]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Angular js code
<html ng-app="myApp">
<div ng-controller="ctrl1">
<table>
<tr ng-repeat="x in names">
<td>{{x.cardname}}</td>
</tr>
</table>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('ctrl1', function ($scope, $http) {
$http.get("http://localhost:2383/WebService1.asmx")
.success(function (response) { $scope.names = response; });
});
</script>
</html>
Regards,
Gaurav
On Fri, Mar 20, 2015 at 7:57 PM, Sander Elias <[email protected]> wrote:
> Hi,
>
> Well, probably there is some coding error somewhere. $http is one of the
> most used services in Angular, and bugs like those would probably be
> detected by now ;)
>
> Regards
> Sander
>
> PS, if you want a more helpful answer, it helps if you post a plunk, or at
> least the code that is giving you the problem!
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/AFuudQjvji4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
Regards,
Gaurav Raut
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.