angular.js:13424 TypeError: d.scope.init is not a function
See original GitHub issueAngular 1.5.3
Getting this error when the first toast is called, after we have to click the toast to disable it, the it works fine.
angular.js:13424 TypeError: d.scope.init is not a function
at angular-toastr.min.js:1
at angular.js:15757
at m.$eval (angular.js:17025)
at m.$digest (angular.js:16841)
at angular.js:17064
at e (angular.js:5824)
at angular.js:6100
var CMWebApp = angular.module('CMWebApp', ['ngRoute', 'ngAnimate', 'ngCookies', 'toastr','ngMaterial']);
CMWebApp.config(function(toastrConfig) {
angular.extend(toastrConfig, {
autoDismiss: true,
maxOpened: 0,
newestOnTop: true,
positionClass: 'toast-bottom-right',
preventDuplicates: false,
preventOpenDuplicates: true,
allowHtml: true,
closeButton: false,
closeHtml: '<button>×</button>',
extendedTimeOut: 1000,
iconClasses: {
error: 'toast-error',
info: 'toast-info',
success: 'toast-success',
warning: 'toast-warning'
},
messageClass: 'toast-message',
onHidden: null,
onShown: null,
onTap: null,
progressBar: true,
tapToDismiss: true,
templates: {
toast: appUrl + '/views/directives/toast/toast.html',
progressbar: appUrl + '/views/directives/progressbar/progressbar.html'
},
timeOut: 3000,
titleClass: 'toast-title',
toastClass: 'toast'
});
});
CMWebApp.config(function($routeProvider, $sceDelegateProvider, $locationProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
'self',
appUrl + '/**'
]);
$routeProvider
.when('/', {
title: 'Homepage',
templateUrl: appUrl + '/views/home.html',
controller: 'mainCtrl'
})
$locationProvider.html5Mode({
enabled: true,
});
});
CMWebApp.controller('mainCtrl', function($scope, $rootScope, $sce, $route, $routeParams, $location, $http, $window, toastr) {
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
$scope.domain = domain;
$scope.home = webUrl;
$scope.assets = appUrl;
$scope.trustAsHtml = $sce.trustAsHtml;
$scope.goTo = function(url) {
$window.open(url, '_blank');
toastr("Button clicked");
}
console.log("Page is loaded");
});
Please help!
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Angular dataService.init is not a function when trying to call ...
I believe the problem is that the function init is not defined in the angular factory . The DataFactory function is returning an...
Read more >ngInit - AngularJS: API
The ngInit directive allows you to evaluate an expression in the current scope. This directive can be abused to add unnecessary amounts of...
Read more >undefined is not a function on init function in Angular factory
TypeError : undefined is not a function on init function in Angular ... I have simple factory in AngularJS: ... $rootScope = _$rootScope_;...
Read more >Top 18 Most Common AngularJS Developer Mistakes - Toptal
angular.element(document.body).scope(). It can be useful even when not using jQuery with its CSS, but should not be used outside of the console.
Read more >Angular ng-init Directive - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For now then, delete that config and where you import toastr.js import toastr.tpl.js
Ok thanks 😃