ng-tasty icon indicating copy to clipboard operation
ng-tasty copied to clipboard

.success problem with angular 1.6.0

Open p1lare opened this issue 8 years ago • 1 comments

Since angular 1.5 $http's deprecated custom callback methods - success() and error() - have been removed in angular 1.6. ngTasty needs some changes. https://docs.angularjs.org/guide/migration#migrate1.5to1.6-ng-services-$http

ng-tasty-tpls.js from 559 and 739 this code needs to be changed:



    if (scope.templateUrl) {
        $http.get(scope.templateUrl, { cache: $templateCache })
        .success(function(templateContent) {
        element.replaceWith($compile(templateContent)(scope));
      });
    }

to this:

    if (scope.templateUrl) {
        $http.get(scope.templateUrl, { cache: $templateCache })    
        .then(function onSuccess(response) {          
          element.replaceWith($compile(response.data)(scope));
        }, function onError(response) {
          console.log(response.status,response.statusText);
      });
    }

This maybe needs some confirmation, seems to work for me just fine. If the project is still alive I can make a pull request.

p1lare avatar Dec 21 '16 20:12 p1lare

+1 same issue here: Angular 1.6.1 and some templateUrl-calls fail due to success being deprecated in 1.6.x

fdenzer avatar Jan 18 '17 19:01 fdenzer