Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$http.get(...).success is not a function angular 1.6 #106

Closed
okosowski opened this issue Nov 23, 2016 · 16 comments
Closed

$http.get(...).success is not a function angular 1.6 #106

okosowski opened this issue Nov 23, 2016 · 16 comments

Comments

@okosowski
Copy link

with angular v1.6.0-rc.0, any use Notification throw

TypeError: $http.get(...).success is not a function
@cklemming
Copy link

cklemming commented Dec 2, 2016

Yes, in Angular 1.6 the $http Success/Error callback methods have been deprecated.

They should be replaced by .then(...) everywhere in this library.

@celsomtrindade
Copy link

Besides this change (.then())

line 56
$http.get(args.template,{cache: $templateCache}).then(function(template) {

line 189
}, function(data){

I'm also facing some issues related to jqLite when usin .bind(). Around this line:

line 126
if (args.closeOnClick) {
    templateElement.addClass('clickable');
    templateElement.bind('click', closeEvent);
}

@MikhailRoot
Copy link
Contributor

MikhailRoot commented Dec 12, 2016

https://github.com/MikhailRoot/angular-ui-notification working with angular 1.6 also I've added direct templateCache loading if we load default template which is present in ui-notification module. I've submited edits As PR

@teklakct
Copy link

As @cklemming says, in Angular 1.6 $http Success/Error callback methods have been deprecated.

$http's deprecated custom callback methods - success() and error() - have been removed (...) but note that the method signatures and return values are different.

Due to b54a39

You should find more info in about changes with $http in migration guide.

@cropcrop
Copy link

cropcrop commented Dec 16, 2016

@alexcrack Any chance @MikhailRoot 's solution will be merged? It would be great to have this callbacks deprecation fixed soon as many angular projects are broken after upgrading to angular 1.5.9+

@MikhailRoot
Copy link
Contributor

MikhailRoot commented Dec 16, 2016

Hi ! i've updated bower.json to resolve properly for angular 1.5.x and 1.6 of package so untill our PR will be merged to master you can specify fork with fixes in your bower.json file with this line:

"angular-ui-notification": "MikhailRoot/angular-ui-notification#0.3.4",

in your dependencies section.

@cropcrop
Copy link

Great! Thank you @MikhailRoot

@edgaraskazlauskas
Copy link

@MikhailRoot Do you not get the "Template (http://path.html) could not be loaded. TypeError: element.addEventListener is not a function" error?

@MikhailRoot
Copy link
Contributor

@interruptr this exception is Thrown in code just like in previous versions, if Notification service can't access template neither from templateCache nor from $http. Also what do you mean by http://path.html as path to your template. There are some points to consider:

  1. Do you preload your template into template cache? (with nghtml2js or something like that)
  2. Do you use this module in Cordova\PhoneGap app? - if so - I found the best approach is to use preloaded into templateCache templates, and specifying path's to them like /templates/yourtemplate.html
  3. May be I'm wrong but in general it's not a good idea to try to get template from fully qualified url like you've provided in example. At least i've never seen this in code. If you are developing website you can specify relative path(better starting from forward slash like /partials/templatename.html ), but much better - use templateCache with preloaded templates - with this approach you'll overcome a lot of troubles with relative paths of your app and templates.

@edgaraskazlauskas
Copy link

edgaraskazlauskas commented Dec 23, 2016

@MikhailRoot I require it with webpack and insert the template into template cache (not a cordova app). I found a workaround for this - if I add a template into templateCache with the name of the default template ("angular-ui-notification.html") then it works. Otherwise the error described above gets thrown... It's quite interesting. I will look into the issue a bit later.

@MikhailRoot
Copy link
Contributor

@interruptr Thank you for investigation and insight, i've updated code to check templateCache first both default and custom specified template names.
Latest fixes with update in bower.json

"angular-ui-notification": "MikhailRoot/angular-ui-notification#0.3.5"

then bower update

tonylampada added a commit to tonylampada/angular-ui-notification that referenced this issue Dec 23, 2016
@tonylampada tonylampada mentioned this issue Dec 23, 2016
@tonylampada
Copy link

tonylampada commented Dec 23, 2016

I've submitted #109 just in the case @alexcrack is in a hurry and can't find the time to give the deserved attention to @MikhailRoot 's #108

@bhaveshvyas007
Copy link

Please fix this asap...

@MikhailRoot
Copy link
Contributor

@bhaveshvyas007 as i mentioned above untill fixed or merged use

"angular-ui-notification": "MikhailRoot/angular-ui-notification#0.3.5"

in your bower.json then update. works with angular 1.6

@jebberwocky
Copy link

@MikhailRoot guess that we need to use your branch for now

@alexcrack
Copy link
Owner

Merged @MikhailRoot's pull-request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests