diff --git a/src/components/dialog/dialog.js b/src/components/dialog/dialog.js index 394f295728f..e44638a0183 100644 --- a/src/components/dialog/dialog.js +++ b/src/components/dialog/dialog.js @@ -424,15 +424,18 @@ function MdDialogProvider($$interimElementProvider) { return $$interimElementProvider('$mdDialog') .setDefaults({ - methods: ['disableParentScroll', 'hasBackdrop', 'clickOutsideToClose', 'escapeToClose', 'targetEvent', 'closeTo', 'openFrom', 'parent', 'fullscreen'], + methods: ['disableParentScroll', 'hasBackdrop', 'clickOutsideToClose', 'escapeToClose', + 'targetEvent', 'closeTo', 'openFrom', 'parent', 'fullscreen'], options: dialogDefaultOptions }) .addPreset('alert', { - methods: ['title', 'htmlContent', 'textContent', 'ariaLabel', 'ok', 'theme', 'css'], + methods: ['title', 'htmlContent', 'textContent', 'content', 'ariaLabel', 'ok', 'theme', + 'css'], options: advancedDialogOptions }) .addPreset('confirm', { - methods: ['title', 'htmlContent', 'textContent', 'ariaLabel', 'ok', 'cancel', 'theme', 'css'], + methods: ['title', 'htmlContent', 'textContent', 'content', 'ariaLabel', 'ok', 'cancel', + 'theme', 'css'], options: advancedDialogOptions }); @@ -510,7 +513,8 @@ function MdDialogProvider($$interimElementProvider) { function beforeShow(scope, element, options, controller) { if (controller) { controller.mdHtmlContent = controller.htmlContent || options.htmlContent || ''; - controller.mdTextContent = controller.textContent || options.textContent || ''; + controller.mdTextContent = controller.textContent || options.textContent || + controller.content || options.content || ''; if (controller.mdHtmlContent && !$injector.has('$sanitize')) { throw Error('The ngSanitize module must be loaded in order to use htmlContent.'); diff --git a/src/components/dialog/dialog.spec.js b/src/components/dialog/dialog.spec.js index b7b1f59b866..bcc7a504614 100644 --- a/src/components/dialog/dialog.spec.js +++ b/src/components/dialog/dialog.spec.js @@ -256,6 +256,26 @@ describe('$mdDialog', function() { expect(content.text()).toBe('Choose'); })); + it('should support the deprecated `content` method as text', inject(function($mdDialog) { + var parent = angular.element('
'); + + $mdDialog.show( + $mdDialog.confirm({ + parent: parent, + ok: 'Next', + cancel: 'Back', + title: 'Which Way ', + content: '
Choose
' + }) + ); + + runAnimation(); + + var contentBody = parent[0].querySelector('.md-dialog-content-body'); + + expect(contentBody.textContent).toBe('
Choose
'); + })); + it('should NOT allow custom elements in confirm htmlContent', inject(function($mdDialog) { var parent = angular.element('
');