Unknown provider for $modalStackProvider while including ui-bootstrap - javascript

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.

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.

Why can't I load angular-cookies into my app?

I am trying to fix this problem, but I can't get it to work. I want to include the NgCookies (angular-cookies) into my app, but it's just giving me an error.
I have this:
Including the JS:
<html>
<script src="js/angular1.6.1.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-cookies.js"></script>
</html>
Application controller:
var myApp = angular.module('myApp', ['ionic', 'ui.router', 'ngCordova', 'ngCookies']);
The controller:
myApp.controller('HomeController', ['$scope', '$cookies', function ($scope, $cookies) {
// Retrieving a cookie
$scope.userName = $cookies.userName || "";
// Setting a cookie
$cookies.userName = 'testUser';
}]);
The error I am getting is:
Error: [$injector:unpr] Unknown provider: $cookiesProvider <- $cookies <- HomeController
I am using Angular version 1.6.1 and Angular-Cookies version 1.6.1
I don't know what I am doing wrong here. I checked other questions, but the solutions given there are not working for me. I checked the versions, I checked if I include Angular before Angular-Cookies etcetera. I am out of options now.
It should work as expected if you included the same version of angular and angular-cookie as in this plunkr.
I see that you are injecting ngCordova and i believe that you are using ionic framework in your development. By default, Ionic comes bundle with angularJS and there is no need to include additional angular.js script on top of ionic and you should avoid doing so as it could lead to unexpected break.
I would suggest you to check the angular version that comes bundle with the ionic version you are using and include the same version of angular-cookies with the angular version that comes bundle with ionic.

Switching from ng-route to angular-ui-router

Since I needed nested views in my AngularJS application (1.4), I decided to switch routing library from ngRoute to ui.router.
Now everything seems to work fine but in some controller I still have to import ngRoute in order not to crash the application.
One of these contrller is the controller for the landing page:
angular.module(
'myApp.landing', ['ngRoute'], ["$compileProvider", function($compileProvider){
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|sms|whatsapp):/);
}]).
Here if I switch from 'ngRoute' to 'ui.router' I get this error:
angular.js:38Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.10/$injector/modulerr?p0=myApp&p1=Error%3A%…Flocalhost%3A3003%2Fbower_components%2Fangular%2Fangular.min.js%3A20%3A274)
The problem is that the error does not really tell me much about what's going on and which part of my code still depend on the module ngRoute.
Do you have an idea about how to approach this problem?

AngularJS $UibModal triggering [$injector:unpr]

I'll keep this short.
I'm very new to angularjs and I'm following one of Pluralsights tutorials.
Since the release of the tutorial there are many deprecated built ins that are driving me nuts.
I'm trying to use the following code
angularFormsApp.controller("HomeController",
function ($scope, $location, $uibModal, DataService) {
$scope.showCreateEmployeeForm = function () {
//$location.path('/newEmployeeForm');
$uibModal.open({
templateUrl: 'app/EmployeeForm/efTemplate.html',
controller: 'efController'
});
})
The tutorial is showing to use $modal (which is now deprecated)... I've tried just using $uibModal instead, and when clicking the button, the event is not firing and I'm getting the following error
Error: [$injector:unpr] http://errors.angularjs.org/1.3.0/$injector/unpr?p0=%24animateCssProvider%20%3C-%20%24animateCss%20%3C-%20%24uibModalStack%20%3C-%20%24uibModal
Oh - I also installed angular using NuGet so I have the latest release
The animateCssProvider is only available for angular 1.4+, and you're using 1.3.
From bootstrap UI website:
AngularJS (requires AngularJS 1.4.x or higher, tested with 1.5.3).
0.14.3 is the last version of this library that supports AngularJS 1.3.x and 0.12.0 is the last version that supports AngularJS 1.2.x.
Just update your angular version.

Unable to inject Ng-SweetAlert-2 in AngularJS

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 */]

Categories

Resources