2016-04-05 5 views
0

Ich versuche, einen Alarm Dialog mit kantigem Material Design zu aktivieren.

In meinem Controller, ich habe:

angular.module('KidHubApp') 
    .controller('ActivityCtrl', ['$scope','$meteor', '$stateParams', '$mdDialog', '$state', function($scope, $meteor, $stateParams, $state, $mdDialog){ 

...

$mdDialog.show(
$mdDialog.alert() 
.clickOutsideToClose(true) 
.title('No timeslot selected.') 
.textContent('Please select a date and a timeslot to make a reservation.') 
.ok("Got it!") 
.targetEvent(ev) 
    ); 
} 

Allerdings bin ich in der Konsole bekommen:

TypeError: $mdDialog.alert is not a function

Wie kann ich dieses Problem lösen?

+0

in der Entwicklerkonsole zu testen .. –

Antwort

1

Ihre Funktion params nicht Injektion übereinstimmen, um ...

angular.module('KidHubApp') 
    .controller('ActivityCtrl', ['$scope','$meteor', '$stateParams', '$mdDialog', '$state', function($scope, $meteor, $stateParams, $state, $mdDialog){ 

sollte

angular.module('KidHubApp') 
    .controller('ActivityCtrl', ['$scope','$meteor', '$stateParams', '$mdDialog', '$state', function($scope, $meteor, $stateParams, $mdDialog, $state){ 

$state und $mdDialog in Ihrer Funktion params Swapping sein, die Reihenfolge theyre in injiziert entsprechen .. .

+0

dumm ich Sie können versuchen, das $ mdDialog Objekt zum globalen Fenster-Objekt hinzuzufügen und dann ... Danke ! –

Verwandte Themen