Hey guys, I'm having problem to bind the variable in the view. It was
working using mock but then I changed to Ajax call stop working ...
I have this in my *service*:
moduleApp.service('concertService', function () {
> var concerts,
> baseUrl =
> "http://findconcertsservice.cloudapp.net/FindConcertsService.svc/";
> this.findAll = function () {
>
>
> /*makeCorsRequest('http://findconcertsservice.cloudapp.net/FindConcertsService.svc/findAll?format=json',
> 'GET');*/
> /*under same-origin-policy
> Cross-domain ajax with Cross-Origin Resource Sharing (CORS),
> using HTTP Headers to allow both browsers and server more about
> each other due to different domain XMLHttpRequest */
> $.ajax({
> url: baseUrl + "findAll?format=json",
> dateType: "jsonp",
> async: false,
> success:function(data) {
> console.log("Data retrieve successfully")
> },
> error: function(data){
> alert("Error loading data");
> }
> }).done(function(data){
> return data;
> });
> };
> });
The controller call
moduleApp.controller('SearchConcertController', function ($scope,
> concertService) {
> $scope.pageTitle = "Search Concerts";
>
> $scope.findAll = function(){
> $scope.concerts = concertService.findAll();
> console.log($scope.concerts);
> }
> });
This findAll function is executing in ng-init . The view is correct
bindided with variable because was working with mocks ... but now it's not
working with Ajax call.
Thanks !
--
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.