diff --git a/ionic/components/button/button.ts b/ionic/components/button/button.ts index 9151012bf9..b0d45f3004 100644 --- a/ionic/components/button/button.ts +++ b/ionic/components/button/button.ts @@ -1,4 +1,4 @@ -import {Directive, ElementRef} from 'angular2/angular2'; +import {Directive, ElementRef, Renderer} from 'angular2/angular2'; import {IonicConfig} from '../../config/config'; @@ -13,7 +13,8 @@ export class Button { constructor( config: IonicConfig, - elementRef: ElementRef + elementRef: ElementRef, + renderer: Renderer ) { let element = elementRef.nativeElement; @@ -21,6 +22,12 @@ export class Button { element.classList.add('disable-hover'); } + // TODO this isn't working in the popup + if (element.hasAttribute('type')) { + let type = element.getAttribute("type"); + renderer.setElementAttribute(elementRef, type, ""); + } + if (element.hasAttribute('ion-item')) { // no need to put on these icon classes for an ion-item return; diff --git a/ionic/components/popup/popup.ts b/ionic/components/popup/popup.ts index a8df93832f..c96efb38f1 100644 --- a/ionic/components/popup/popup.ts +++ b/ionic/components/popup/popup.ts @@ -4,6 +4,7 @@ import {FORM_DIRECTIVES, NgControl, NgControlGroup, import {OverlayController} from '../overlay/overlay-controller'; import {IonicConfig} from '../../config/config'; import {Animation} from '../../animations/animation'; +import {Button} from '../button/button'; import * as util from 'ionic/util'; @@ -101,7 +102,7 @@ export class Popup { * template: '', // String (optional). The html template to place in the popup body. * templateUrl: '', // String (optional). The URL of an html template to place in the popup body. * okText: '', // String (default: 'OK'). The text of the OK button. - * okType: '', // String (default: 'primary'). The type of the OK button. + * okType: '', // String (default: ''). The type of the OK button. * } * ``` * @@ -115,7 +116,7 @@ export class Popup { } let button = { text: opts.okText || 'OK', - type: opts.okType || 'primary', + type: opts.okType || '', onTap: (event, popupRef) => { // Allow it to close //resolve(); @@ -148,9 +149,9 @@ export class Popup { * template: '', // String (optional). The html template to place in the popup body. * templateUrl: '', // String (optional). The URL of an html template to place in the popup body. * cancelText: '', // String (default: 'Cancel'). The text of the Cancel button. - * cancelType: '', // String (default: 'primary'). The type of the Cancel button. + * cancelType: '', // String (default: ''). The type of the Cancel button. * okText: '', // String (default: 'OK'). The text of the OK button. - * okType: '', // String (default: 'primary'). The type of the OK button. + * okType: '', // String (default: ''). The type of the OK button. * } * ``` * @@ -164,14 +165,14 @@ export class Popup { } let okButton = { text: opts.okText || 'OK', - type: opts.okType || 'primary', + type: opts.okType || '', onTap: (event, popupRef) => { // Allow it to close } } let cancelButton = { text: opts.cancelText || 'Cancel', - type: opts.cancelType || 'primary', + type: opts.cancelType || '', isCancel: true, onTap: (event, popupRef) => { // Allow it to close @@ -204,9 +205,9 @@ export class Popup { * inputType: // String (default: 'text'). The type of input to use. * inputPlaceholder: // String (default: ''). A placeholder to use for the input. * cancelText: '', // String (default: 'Cancel'). The text of the Cancel button. - * cancelType: '', // String (default: 'primary'). The type of the Cancel button. + * cancelType: '', // String (default: ''). The type of the Cancel button. * okText: '', // String (default: 'OK'). The text of the OK button. - * okType: '', // String (default: 'primary'). The type of the OK button. + * okType: '', // String (default: ''). The type of the OK button. * } * ``` * @@ -220,7 +221,7 @@ export class Popup { } let okButton = { text: opts.okText || 'OK', - type: opts.okType || 'primary', + type: opts.okType || '', onTap: (event, popupRef) => { // Allow it to close } @@ -228,7 +229,7 @@ export class Popup { let cancelButton = { text: opts.cancelText || 'Cancel', - type: opts.cancelType || 'primary', + type: opts.cancelType || '', isCancel: true, onTap: (event, popupRef) => { // Allow it to close @@ -264,10 +265,10 @@ export class Popup { const OVERLAY_TYPE = 'popup'; - @Component({ selector: 'ion-popup' }) +// TODO add button type to button: [type]="button.type" @View({ template: '' + @@ -284,7 +285,7 @@ const OVERLAY_TYPE = 'popup'; '' + '' + '', - directives: [FORM_DIRECTIVES, NgClass, NgIf, NgFor] + directives: [FORM_DIRECTIVES, NgClass, NgIf, NgFor, Button] }) class PopupCmp { diff --git a/ionic/components/popup/test/basic/index.ts b/ionic/components/popup/test/basic/index.ts index 4a5e9a2e76..1f22c5c096 100644 --- a/ionic/components/popup/test/basic/index.ts +++ b/ionic/components/popup/test/basic/index.ts @@ -32,8 +32,7 @@ class E2EApp { title: "New Album", template: "Enter a name for this new album you're so keen on adding", inputPlaceholder: "Title", - okText: "Save", - okType: "secondary" + okText: "Save" }).then((name) => { this.promptResult = name; this.promptOpen = false;