Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/scripts/directives/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ directives.directive('oauth', [
};

var compile = function() {
$http.get(scope.template, { cache: $templateCache }).success(function(html) {
element.html(html);
$http.get(scope.template, { cache: $templateCache }).then(function(html) {
element.html(html.data);
$compile(element.contents())(scope);
});
};
Expand All @@ -87,8 +87,8 @@ directives.directive('oauth', [
var token = AccessToken.get();

if (token && token.access_token && scope.profileUri) {
Profile.find(scope.profileUri).success(function(response) {
scope.profile = response;
Profile.find(scope.profileUri).then(function(response) {
scope.profile = response.data;
});
}
};
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/services/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ profileClient.factory('Profile', ['$http', 'AccessToken', '$rootScope', function

service.find = function(uri) {
var promise = $http.get(uri, { headers: headers() });
promise.success(function(response) {
profile = response;
promise.then(function(response) {
profile = response.data;
$rootScope.$broadcast('oauth:profile', profile);
});
return promise;
Expand Down
14 changes: 7 additions & 7 deletions dist/oauth-ng.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* oauth-ng - v0.4.10 - 2016-05-25 */
/* oauth-ng - v0.4.10 - 2017-02-23 */

'use strict';

Expand Down Expand Up @@ -684,8 +684,8 @@ profileClient.factory('Profile', ['$http', 'AccessToken', '$rootScope', function

service.find = function(uri) {
var promise = $http.get(uri, { headers: headers() });
promise.success(function(response) {
profile = response;
promise.then(function(response) {
profile = response.data;
$rootScope.$broadcast('oauth:profile', profile);
});
return promise;
Expand Down Expand Up @@ -898,8 +898,8 @@ directives.directive('oauth', [
};

var compile = function() {
$http.get(scope.template, { cache: $templateCache }).success(function(html) {
element.html(html);
$http.get(scope.template, { cache: $templateCache }).then(function(html) {
element.html(html.data);
$compile(element.contents())(scope);
});
};
Expand All @@ -908,8 +908,8 @@ directives.directive('oauth', [
var token = AccessToken.get();

if (token && token.access_token && scope.profileUri) {
Profile.find(scope.profileUri).success(function(response) {
scope.profile = response;
Profile.find(scope.profileUri).then(function(response) {
scope.profile = response.data;
});
}
};
Expand Down
2 changes: 1 addition & 1 deletion test/spec/directives/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe('oauth', function() {
spyOn(Endpoint, 'redirect');
});

it('shows the text "Sing In"', function() {
it('shows the text "Sign In"', function() {
result = element.find('.logged-out').text();
expect(result).toBe('Sign In');
});
Expand Down
2 changes: 1 addition & 1 deletion test/spec/services/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Profile', function() {
});

it('gets the resource', inject(function(Profile) {
Profile.find(params.profileUri).success(function(response) { result = response; });
Profile.find(params.profileUri).then(function(response) { result = response.data; });
$rootScope.$apply();
$httpBackend.flush();
expect(result.name).toEqual('Alice');
Expand Down