Use $mdDialog stright from controller <p>Trying to use the $mdDialog when login fails; currently I have injected $mdDialog and where my response fails I have added the following code:</p> <p><strong>$mdDialog Code:</strong></p> <pre><code>$mdDialog.show( $mdDialog.alert() .title('Username / password is incorrect') .textContent(response.message) .ok('Got it!')); </code></pre> <p>Any Idea what am I doing wrong ?</p> <p><strong>My error</strong></p> <pre><code>$mdDialog.alert(...).title(...).textContent is not a function </code></pre> <p><strong>My controller (I don't think its necessary but just encase ):</strong></p> <pre><code>(function () { 'use strict'; angular .module('app') .controller('authController', authController); authController.$inject = ['$scope','$state','AuthService','$mdDialog']; function authController($scope,$state,AuthService,$mdDialog) { $scope.login = login; $scope.user = {email: 'user', pass: 'pass'}; function login(){ this.dataLoading = true; AuthService.Login(this.user.email, this.user.pass, function (response) { console.log(response); if (response.success) { $state.go("dashboard"); } else { $mdDialog.show( $mdDialog.alert().title('Username / password is incorrect').textContent(response.message) .ok('Got it!')); } }); } }; })(); </code></pre>