简体   繁体   中英

Angularjs toaster not showing up

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM