feat(button): Added ability to give the button a "type" which will be converted to an attribute.

Note this is working for basic buttons but breaks in the popup
currently, that is a TODO. Changed the default to types for the popup
to an empty string. Closes #183
This commit is contained in:
Brandy Carney
2015-10-05 12:37:46 -04:00
parent fe1fb5fa3c
commit d4c2342414
3 changed files with 23 additions and 17 deletions

View File

@@ -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;