Make scope work with promises

342 views
Skip to first unread message

mark.le...@gmail.com

unread,
Jul 24, 2012, 5:43:04 AM7/24/12
to ang...@googlegroups.com
Hello fellow angular developers,

first of all, I'd like to start by saying that I really enjoy working with angularjs. At long last a framework which got all the crucial concepts right.

That being said, I am wondering why you decided to introduce $resource as a means for easily assigning future resource responses to the scope, rather than opting for supporting promises in a general manner within the scope.

I'd much rather use the lightweight $http api and write:

$scope.myResource = $http.get( 'http//...' )

rather than have to write

$http.get( 'http//...' ).success( function( myResource ) {
   $scope.myResource = myResource;
}

as is the case now.

Best Regards

Mark Lehmacher

Peter Bacon Darwin

unread,
Jul 24, 2012, 5:47:03 AM7/24/12
to ang...@googlegroups.com
Resource development was stalled in the stampede to get Angular 1.0 out.  I believe it will be revisited soon.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/Pm40jesLF1sJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Kai Groner

unread,
Jul 24, 2012, 11:43:06 AM7/24/12
to ang...@googlegroups.com
Hi Mark,

$resource provides some other benefits, like url templating, but sometimes $http is all you need.

Scopes do resolve promises.

I ran into a few issues with this in the past (promises resolving to functions didn't always work), but support seems pretty robust now.


Kai



--
Reply all
Reply to author
Forward
0 new messages