简体   繁体   English

AngularJS烤面包机未显示

[英]Angularjs toaster not showing up

I am using this library for angularjs toaster: 我正在将此库用于angularjs烤面包机:

https://github.com/jirikavi/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? 如此您就知道我正在使用angualarjs 1.2.16我不知道我在这里缺少什么吗?

You didn't mention that you added 您没有提到您添加了

<toaster-container></toaster-container>

to index.html 到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. AngularJS-Toaster需要AngularJS v1.2.6或更高版本,并且专门针对AngularJS,而不是Angular 2,尽管可以通过ngUpgrade使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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