I am using this library for angularjs toaster:
https://github.com/jirikavi/AngularJS-Toaster
and added the following references:
<link rel="stylesheet" href="bower_components/AngularJS-Toaster/toaster.min.css" type="text/css">
<script src="bower_components/angular/angular.min.js"></script>
<script src="https://code.angularjs.org/1.2.16/angular-animate.min.js"></script>
<script src="/bower_components/AngularJS-Toaster/toaster.min.js"></script>
I also added angular-animate as it seems using it, and added dependency injection on app module as:
.module('venture', [
'oc.lazyLoad',
'ui.router',
'ui.bootstrap',
'angular-loading-bar',
'satellizer',
'angularPayments',
'angularFileUpload',
'ngBootbox',
'ui.tinymce',
'ngSanitize',
'pikaday',
'ngAnimate',
'toaster',
])
My controller parametes looks as:
.controller("ClassController", ['$scope', '$location', '$rootScope', '$timeout', '$state', 'ClassService', 'ERROR_MSG', 'SUCCESS_MSG', 'FileUploader', 'REST_END_POINT', '$stateParams', 'UserService', 'toaster',
function ($scope, $location, $rootScope, $timeout, $state, ClassService, ERROR_MSG, SUCCESS_MSG, FileUploader, REST_END_POINT, $stateParams, UserService, toaster) {
and somewhere on the code I am using:
toaster.pop('success', "title", "text");
I know it comes here the execution but the toaster never shows up, nor the error comes...
Just so you know I am using angualarjs 1.2.16
I donw know what I am missing out here?
You didn't mention that you added
<toaster-container></toaster-container>
to index.html
Maybe that's it?
From the documentation of the toaster plugin your using:
AngularJS-Toaster requires AngularJS v1.2.6 or higher and specifically
targets AngularJS, not Angular 2, although it could be used via
ngUpgrade.
Related
I am trying to use uibModal (from angular-ui-bootstrap v0.12.1) in an angularJS application (v.148). I am aware of the current angular versions. When I am trying to use the modal using example code below, I am seeing the error:
TypeError: $uibModal.open is not a function
I have added the following to the application:
angular.module('someApp', ['ui.bootstrap']);
In the controller file, I am using the following:
angular.module('someAppController')
.controller('someController', ['$scope', '$http', $'location', '$modal', 'someService',
function($scope, $http, $locaton, $uibModal, someService) {
On an event:
$uibModal.open({
templateUrl: 'some.html',
windowClass: 'modal-danger'
});
I have tried replacing $uibModal to $modal (both in the module call and where I am trying to create the modal). However, I get the same error complaining about $uibModal.open or $modal.open is not a fucntion. Any thoughts on what I am doing wrong? I cannot find any issues with the versions or other dependencies causing issues.
You have some typos in your code and are not properly injecting the $uibModal provider
change
.controller('someController', ['$scope', '$http', $'location', '$modal', 'someService'
to
.controller('someController', ['$scope', '$http', '$location', '$uibModal', 'someService'
also change
templateUrk: 'some.html',
to
templateUrl: 'some.html',
I am trying to user cookies but I get the following error.
ionic.bundle.js:25642 Error: [$injector:unpr] Unknown provider:
UserServiceProvider <- UserService <- AuthenticationService
I did the following:
1) mentioned this in my index.html
<script src="//code.angularjs.org/1.4.3/angular-cookies.js"></script>
2) in my app.js I added ngCookies
angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives','app.filters','ngSanitize','ngCookies','base64'])
3) then I created a new service, i referenced it in my index.
<script src="js/authenticationService.js"></script>
4) I included $cookies in my authenticationService.js
(function () {
'use strict';
angular
.module('app')
.factory('AuthenticationService', AuthenticationService);
AuthenticationService.$inject = ['$http', '$cookieStore', '$rootScope', '$timeout', 'UserService','$cookies'];
function AuthenticationService($http, $cookieStore, $rootScope, $timeout, UserService,$cookies) {...
can someone help me with the error?
When I change the angular cookies version to 1.2.20, i get this error instead
ionic.bundle.js:25642 TypeError: $browser.addPollFn is not a function
at Object. (angular-cookies.js:60)
As stated above in the comments. In your authenticationService.js, you have this line AuthenticationService.$inject = ['$http', '$cookieStore', '$rootScope', '$timeout', 'UserService','$cookies'];. This means that there should be injectable components like services / factories / controllers available for Angular when this service is initialized.
In this case all components other than UserService are available either as a part of angular.js or as other packages like angular-cookies.js.
Can you add a definition for UserService.js as well then your app should work.
I am building an app with MEAN.js and I am trying to add https://github.com/oitozero/ngSweetAlert
The first thing I did was to edit the config/env/all.js file to include the javascript files for SweetAlert
I then edited the public/dist/application.js file to add the "oitozero.ngSweetAlert" module as follows:
var applicationModuleVendorDependencies = ['ngResource', 'ngCookies', 'ngAnimate', 'ngTouch', 'ngSanitize', 'ui.router', 'ui.bootstrap', 'ui.utils', 'oitozero.ngSweetAlert'];
Now in my controller I try to add the module, and once I do this I get the Unknown Provider error:
angular.module('stock').controller('myController', ['$rootScope', '$scope', '$stateParams', '$location', '$http', '$modal', 'Authentication', 'Stock', 'Users', 'SweetAlert',
function($rootScope, $scope, $stateParams, $location, $http, $modal, Authentication, Stock, Users, SweetAlert) {
I would really appreciate any suggestions as to what I am doing wrong. TIA!
I'm trying to use the sticky headers directive from: http://ngmodules.org/modules/sticky-headers
but it doesn't seem to work with the combination of using ng-view.
When using the fsm directive as required, I'm getting an empty view:
angular.module('dashboard', ['fsm']).controller('installerController',
[ '$scope', '$filter','$http','$log', '$location','$compile',
'$routeParams',
function($scope, $filter, $http, $log, $location, $compile, $routeParams)
When not including the fsm directive, everything works fine:
angular.module('dashboard').controller('installerController',
[ '$scope', '$filter','$http','$log', '$location','$compile',
'$routeParams',
function($scope, $filter, $http, $log, $location, $compile, $routeParams)
Your help is much appreciated.
Thanks.
The difference between the method angular.module(string) and angular.module(string, array[]) is that the first one loads a specific module and the second one creates a new angular module
Make sure that you only create your module once
I am trying to use the angular google maps directive with my app, but I keep getting an "undefined error"
This is my app.js
angular.module('app', ['cs'])
.config(['GoogleMapApiProvider'.ns(), function (GoogleMapApi) {
GoogleMapApi.configure({
// key: 'your api key',
v: '3.17',
libraries: 'weather,geometry,visualization'
});
}])
.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
//routes
}])
and my controller
angular.module('cs.Controllers')
.controller('MapController', ['$rootScope', '$scope', '$window', '$document', 'MenuService', 'GoogleMapApi'.ns(),
function($rootScope, $scope, $window, $document, menuService, GoogleMapApi) {
$rootScope.menuList = menuService.all();
}]);
What could be the problem
For others that got here that had added the missing dependency declaration, see: angular-google-maps , undefined is not a function
It looks like they've gotten rid of the ns() function, but haven't updated the documentation yet:
https://github.com/angular-ui/angular-google-maps/pull/872/
https://github.com/angular-ui/angular-google-maps/issues/821
Update all instances of 'string'.ns() to 'uiGmapstring' in your code and you should be good.
You're missing the dependency declaration in your app.
angular.module('app', ['google-maps'.ns(),'cs.Controllers']
Here's a plunker using one of the project's demo pages. I changed it to use the new provider.
http://plnkr.co/edit/eUbkv2qKu92T9iUp7yAF?p=preview