diff --git a/src/components/toast/demoBasicUsage/script.js b/src/components/toast/demoBasicUsage/script.js index d90926c3630..5316089b3ec 100644 --- a/src/components/toast/demoBasicUsage/script.js +++ b/src/components/toast/demoBasicUsage/script.js @@ -43,7 +43,7 @@ angular.module('toastDemo1', ['ngMaterial']) $scope.showSimpleToast = function() { $mdToast.show( $mdToast.simple() - .content('Simple Toast!') + .textContent('Simple Toast!') .position($scope.getToastPosition()) .hideDelay(3000) ); @@ -51,7 +51,7 @@ angular.module('toastDemo1', ['ngMaterial']) $scope.showActionToast = function() { var toast = $mdToast.simple() - .content('Action Toast!') + .textContent('Action Toast!') .action('OK') .highlightAction(false) .position($scope.getToastPosition()); diff --git a/src/components/toast/toast.js b/src/components/toast/toast.js index 7cc998a33df..68fdf84de7f 100644 --- a/src/components/toast/toast.js +++ b/src/components/toast/toast.js @@ -53,7 +53,7 @@ function MdToastDirective($mdToast) { * var app = angular.module('app', ['ngMaterial']); * app.controller('MyController', function($scope, $mdToast) { * $scope.openToast = function($event) { - * $mdToast.show($mdToast.simple().content('Hello!')); + * $mdToast.show($mdToast.simple().textContent('Hello!')); * // Could also do $mdToast.showSimple('Hello'); * }; * }); @@ -84,7 +84,7 @@ function MdToastDirective($mdToast) { * _**Note:** These configuration methods are provided in addition to the methods provided by * the `build()` and `show()` methods below._ * - * - `.content(string)` - Sets the toast content to the specified string. + * - `.textContent(string)` - Sets the toast content to the specified string. * * - `.action(string)` - Adds an action button. If clicked, the promise (returned from `show()`) * will resolve with the value `'ok'`; otherwise, it is resolved with `true` after a `hideDelay` @@ -102,7 +102,7 @@ function MdToastDirective($mdToast) { /** * @ngdoc method - * @name $mdToast#updateContent + * @name $mdToast#updateTextContent * * @description * Updates the content of an existing toast. Useful for updating things like counts, etc. @@ -206,8 +206,8 @@ function MdToastProvider($$interimElementProvider) { options: toastDefaultOptions }) .addPreset('simple', { - argOption: 'content', - methods: ['content', 'action', 'highlightAction', 'theme', 'parent'], + argOption: 'textContent', + methods: ['textContent', 'content', 'action', 'highlightAction', 'theme', 'parent'], options: /* @ngInject */ function($mdToast, $mdTheming) { var opts = { template: [ @@ -234,9 +234,12 @@ function MdToastProvider($$interimElementProvider) { return opts; } }) - .addMethod('updateContent', function(newContent) { + .addMethod('updateTextContent', updateTextContent) + .addMethod('updateContent', updateTextContent); + + function updateTextContent(newContent) { activeToastContent = newContent; - }); + } return $mdToast; @@ -252,7 +255,7 @@ function MdToastProvider($$interimElementProvider) { }; function onShow(scope, element, options) { - activeToastContent = options.content; + activeToastContent = options.textContent || options.content; // support deprecated #content method element = $mdUtil.extractElementByName(element, 'md-toast', true); options.onSwipe = function(ev, gesture) {