Unable to inject Ng-SweetAlert-2 in AngularJS - javascript

It is about this project
I have followed the install process given in the description but I'm getting error:
Error: [$injector:unpr] Unknown provider: 19degrees.ngSweetAlert2Provider <- 19degrees.ngSweetAlert2 <- prkctrl`
I have included sweetalert.js (original sweetalert), sweetalert2 (extended version) and ngsweetalert2 (coming from this project).
I still dont see what is the reason? Name can be an issue?

Make sure you have added the module 19degrees.ngSweetAlert2 to your main application like:
angular.module('myApp', ['19degrees.ngSweetAlert2', /* and other modules */]

Related

Is it possible changing angular 1.3.9 to angular 1.6.5(current version)

I have replaced angular 1.3.9 to angular 1.6.5 and I got this console error.
Uncaught Error: [$injector:unpr] Unknown provider:
$$asyncCallbackProvider <- $$asyncCallback <- $animate <- compile
I have changed nothing on my main angular code.
All services and controllers are same.
Any kind of hint will be appreciate.
As pointed out by Paul Weber on this thread right here, you need to check if the version of the angular-animate you are using matches the new version of AngularJS you just updated (1.6.5).
If services are injected into your controller, all services should be in array, check it for all.
May this help.

angular js syntax errors

I am enough familiar with Javascript as I use it in ajax for PHP but new to AngularJS.
During my first angularJs assignment from "tutorialspoint" I got following error in console:
Error: [$injector:modulerr]
http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=mainApp&p1=%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.3.14%2F%24injector%2Fnomod%3Fp0%3DmainApp%0AM%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A6%3A417%0AOd%2F%3C%2F%3C%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A21%3A412%0Aa%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A21%3A53%0AOd%2F%3C%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A21%3A1%0Ag%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A35%3A46%0As%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A7%3A300%0Ag%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A34%3A399%0Aab%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A38%3A135%0Atc%2Fd%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A17%3A381%0Atc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A18%3A179%0AJd%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A17%3A1%0A%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A249%3A428%0Aa%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A163%3A399%0Alf%2Fc%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.14%2Fangular.min.js%3A32%3A384%0A
Which is not readable at all.
I tried try{} catch(){} but, didn't work.
I couldn't use alert() as angularJS doesn't execute in line.
So I checked line by line and I found out that I had written:
var firstApp = angular.module("mainAp", []);
where I had misspelled data-ng-app which should have been mainApp.
But I couldn't have figured it out if there was 300 lines of code.
so, I wanted to know if there is any simple way to show error very specifically like in php.
"[...] which is not readable at all."
You are using the minified angular.min.js version of Angular. That is a good thing for production (as the file is really smaller), but you can use angular.js during development if you want more readable errors.
To illustrate, this is what you get with the minified version:
Error: $injector:modulerr Module Error Failed to instantiate module
mainApp due to: Error: [$injector:modulerr]
http://errors.angularjs.org/1.4.7/$injector/modulerr?p0=e...)
at Error (native)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:6:416
at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:38:184
at m (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:7:322)
at h (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:37:275)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:37:444
at m (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:7:322)
at h (http://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js:37:275)
...
And with the unminified version:
Error: $injector:nomod
Module Unavailable
Module 'ui.bootstrap' is not
available! You either misspelled the module name or forgot to load it.
If registering a module ensure that you specify the dependencies as
the second argument.
Examples source

Unknown provider for $modalStackProvider while including ui-bootstrap

I'm trying to use ui-bootstrap for Tabs in my application keeping the example on ui-bootstrap's website as reference. For the same I included the js files given in the exapmle which are:
Angular.js, Animate.js, Sanitize.js and BootStrap-tpls.js
But after including these JS Files I'm shown an error:
[$injector:unpr] Unknown provider: $modalStackProvider <- $modalStack
I'm not able to resolve this dependency.
You have some version mismatch.
It used to be $modal, $modalInstance, etc. in old Angular Bootstrap.
Now it is $uibModal, $uibModalInstance, etc.
So check versions of libraries that depends on Angular Bootstrap.

Angular JS - Issue with injector creation

I'm using angular version 1.3.9 and when I try to create injector by below code I'm getting error - Failed to instantiate module pAll due to:
Error: [$injector:unpr] Unknown provider:
code :-
var app = angular.module('pAll', []);
console.log(angular.injector(['pAll','ng']));
Just like to know
whether to include module name in above injector creation - Correct me if I am worng
If we can't specify module name in injector then how can we get the injector created by the module
It should work. Probably you are getting error because of something else. here is a working example (prints with console.log)
http://plnkr.co/edit/lPZxDVclonGTrpE77KjK?p=preview

Module 'smart-table' is not available

I am trying to get started with a smart-table. I am following the instructions available here: http://lorenzofox3.github.io/smart-table-website/
So according to those instructions all I need to do is run, bower install angular-smart-table and then add then add the module angular.module('myApp',['smart-table'] to your angular application. Here's my angular application:
# pwd
/var/www/html
# cat meanVoyApp.js
var app = angular.module("meanVoyApp", ['smart-table']);
But now when I load my markup I get these errors in my browsers console:
Uncaught Error: [$injector:modulerr] Failed to instantiate module meanVoyApp due to:
Error: [$injector:modulerr] Failed to instantiate module smart-table due to:
Error: [$injector:nomod] Module 'smart-table' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.3.14/$injector/nomod?p0=smart-table
I didn't misspell so I guess I "forgot" to load it. So how do I load it? How can I tell if it is already loaded and something else is the problem?
Thanks!
Did you remember to add a reference to the script in your index.html?
<script src="[directoryOfModule]/smart-table.js"></script>
Smart-table comes with some js file. I think you are not loading that before to your meanVoyApp.js load. Use chrome developer tool network panel to identify the java-script are properly loaded nor not.
Use the following code before your app.js load
<script src="http://lorenzofox3.github.io/smart-table-website/bower_components/angular-smart-table/dist/smart-table.js"></script>
Use
bower install angular-smart-table --save
and some good gulp or grunt build tool configuration (e.g. yeoman) will automatically add it to your index.html.
Take a look at your build process.
In case you use ngBoilerplate kickstarter, you need to add the following line:
'vendor/angular-smart-table/dist/smart-table.min.js'
inside vendor_files section of build.config.js file.

Categories

Resources