diff --git a/ionic/components/grid/test/basic/index.ts b/ionic/components/grid/test/basic/index.ts
deleted file mode 100644
index 79aa7512b1..0000000000
--- a/ionic/components/grid/test/basic/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import {App, NavController, IonicView} from 'ionic/ionic';
-
-@App({
- templateUrl: 'main.html'
-})
-class IonicApp {
- constructor() {
- }
-}
diff --git a/ionic/components/grid/test/basic/main.html b/ionic/components/grid/test/basic/main.html
deleted file mode 100644
index 0d1799cf67..0000000000
--- a/ionic/components/grid/test/basic/main.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- Hello
-
-
- Hello
-
-
- Hello
-
-
diff --git a/ionic/components/icon/icon.ts b/ionic/components/icon/icon.ts
index 678473e91d..d24dd8533c 100644
--- a/ionic/components/icon/icon.ts
+++ b/ionic/components/icon/icon.ts
@@ -3,59 +3,15 @@ import {Directive, View, NgClass, ElementRef, Optional, Host, Attribute, Rendere
import {IonicConfig} from '../../config/config';
import {IonicComponent} from '../../config/annotations';
import {Ion} from '../ion';
-import {Platform} from '../../platform/platform';
import {Button} from '../button/button';
-/*
-
-'home': {
- ios: ['ion-ios-home', 'ion-ios-home-outline'],
- md: 'ion-md-home'
-}
-
-1-for-1 swap
-Map of stuff that's 1-for-1
-
-
-
-
-
-Always use the same no matter what
-Cuz it's not in the map of 1-for-1's
-
-
-
-
-Different between modes
-Used different attributes
-
-
-
-
-
-
-Ionicons SVG
-
-
-
-
-
-Custom SVG File
-
-
-
-Custom Font Icon
-
-
-*/
-
-
@Directive({
selector: 'icon',
properties: [
'name',
- 'iconName'
+ 'ios',
+ 'md'
],
host: {
'[attr.aria-label]': 'label',
@@ -63,21 +19,24 @@ Custom Font Icon
'role': 'img'
}
})
-export class IconDirective {
+export class Icon {
constructor(
- private _elementRef: ElementRef,
+ private elementRef: ElementRef,
@Optional() @Host() hostButton: Button,
- @Attribute('forward') forward: string,
config: IonicConfig,
private renderer: Renderer
) {
- let ele = this.ele = _elementRef.nativeElement;
+ let ele = elementRef.nativeElement;
+ this.mode = config.setting('mode');
this.iconLeft = this.iconRight = this.iconOnly = false;
this.ariaHidden = true;
- if (forward !== null) {
- this.iconFwd = config.setting('iconForward');
+ this.iconAttr = null;
+ for (let i = 0, l = ele.attributes.length; i < l; i++) {
+ if (ele.attributes[i].value === '') {
+ this.iconAttr = ele.attributes[i].name;
+ }
}
if (hostButton) {
@@ -103,13 +62,20 @@ export class IconDirective {
}
onInit() {
- if (this.iconFwd) {
- this.name = this.iconFwd;
+ if (this.mode == 'ios' && this.ios) {
+ this.name = this.ios;
+
+ } else if (this.mode == 'md' && this.md) {
+ this.name = this.md;
+
+ } else if (!this.name && this.iconAttr) {
+ this.name = this.iconAttr;
}
+
if (!this.name) return;
// add the css class to show the icon font
- this.renderer.setElementClass(this._elementRef, this.name, true);
+ this.renderer.setElementClass(this.elementRef, this.name, true);
// hide the icon when it's within a button
// and the button isn't an icon only button
@@ -123,36 +89,4 @@ export class IconDirective {
}
- onDestroy() {
- this.ele = null;
- }
-}
-
-
-
-@IonicComponent({
- selector: 'ion-icon',
- properties: [
- 'md',
- 'ios'
- ],
- host: {
- 'mode': 'mode'
- }
-})
-@View({
- template: '',
- directives: [NgClass]
-})
-export class Icon extends Ion {
- constructor(elementRef: ElementRef, ionicConfig: IonicConfig) {
- super(elementRef, ionicConfig);
- }
- onIonInit() {
- this.iconClass = this.ios;
- console.log('ICON', this.mode);
- setTimeout(() => {
- console.log('MODE', this.mode);
- });
- }
}
diff --git a/ionic/components/icon/test/basic/index.ts b/ionic/components/icon/test/basic/index.ts
new file mode 100644
index 0000000000..cdec4abc70
--- /dev/null
+++ b/ionic/components/icon/test/basic/index.ts
@@ -0,0 +1,11 @@
+import {App} from 'ionic/ionic';
+
+
+@App({
+ templateUrl: 'main.html'
+})
+class E2EApp {
+ constructor() {
+ this.homeIcon = 'ion-home';
+ }
+}
diff --git a/ionic/components/icon/test/basic/main.html b/ionic/components/icon/test/basic/main.html
new file mode 100644
index 0000000000..f72073ce70
--- /dev/null
+++ b/ionic/components/icon/test/basic/main.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ionic/config/annotations.ts b/ionic/config/annotations.ts
index d5ce2d142d..e166ef53af 100644
--- a/ionic/config/annotations.ts
+++ b/ionic/config/annotations.ts
@@ -10,7 +10,6 @@ import {
Card, List, ListHeader, Item, ItemGroup, ItemGroupTitle,
Toolbar,
Icon,
- IconDirective,
Checkbox, Switch,
TextInput, TextInputElement, Label,
Segment, SegmentButton, SegmentControlValueAccessor,
@@ -59,7 +58,6 @@ export const IonicDirectives = [
// Media
forwardRef(() => Icon),
- forwardRef(() => IconDirective),
// Forms
forwardRef(() => Segment),