diff --git a/ionic/components/button/test/basic/main.js b/ionic/components/button/test/basic/main.js index bb9e663184..246377113e 100644 --- a/ionic/components/button/test/basic/main.js +++ b/ionic/components/button/test/basic/main.js @@ -1,12 +1,14 @@ import {Component, View, bootstrap} from 'angular2/angular2' -import {Button} from 'ionic/components/button/button' - +import {Button} from 'ionic/ionic' @Component({ selector: '[ion-app]' }) @View({ templateUrl: 'main.html', directives: [Button] }) -class IonicApp {} +class IonicApp { + constructor() { + } +} bootstrap(IonicApp) diff --git a/ionic/ionic.js b/ionic/ionic.js index 190ee40d98..7dd12d7fb7 100644 --- a/ionic/ionic.js +++ b/ionic/ionic.js @@ -1,6 +1,16 @@ // HACKYFILLS (hack + polyfill) import {NgElement, ViewContainer} from 'angular2/angular2' + +//import {DomRenderedElement} from 'ionic/util/render/dom'; + Object.defineProperties(NgElement.prototype, { + /* + renderElement: { + get: function() { + return new DomRenderedElement(this._view.render.delegate.boundElements[this._boundElementIndex]); + } + }, + */ domElement: { get: function() { return this._view.render.delegate.boundElements[this._boundElementIndex]; @@ -8,6 +18,7 @@ Object.defineProperties(NgElement.prototype, { } }); +/* Object.defineProperties(ViewContainer.prototype, { domElement: { get: function() { @@ -15,6 +26,7 @@ Object.defineProperties(ViewContainer.prototype, { } } }); +*/ export * from 'ionic/components' export * from 'ionic/platform/platform' diff --git a/ionic/util/render.js b/ionic/util/render.js new file mode 100644 index 0000000000..4b66e6d6e6 --- /dev/null +++ b/ionic/util/render.js @@ -0,0 +1,25 @@ +/* +import {RenderedElement} from 'ionic/util/render/element'; + +export class DomRenderedElement extends RenderedElement { + constructor(domElement: Element) { + super(domElement) + } + addClass(className) { + this.element.classList.add(classList); + } + removeClass(className) { + this.element.classList.remove(classList); + } + addClasses(classes) { + for(let c of classes) { + this.element.classList.add(c); + } + } + removeClasses(classes) { + for(let c of classes) { + this.element.classList.remove(c); + } + } +} +*/ diff --git a/ionic/util/render/dom.js b/ionic/util/render/dom.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ionic/util/render/element.js b/ionic/util/render/element.js new file mode 100644 index 0000000000..68f95a6384 --- /dev/null +++ b/ionic/util/render/element.js @@ -0,0 +1,14 @@ +/* +class RenderedElement { + constructor(element) { + this.element = element; + } + _notImplemented(fnName) { + console.error("RenderedElement." + fnName + "addClass is not implemented. Use a concrete class like DomRenderedElement instead."); + } + addClass(className) { this._notImplemented('addClass'); } + removeClass(className) { this._notImplemented('removeClass'); } + addClasses(className) { this._notImplemented('addClasses'); } + removeClasses(className) { this._notImplemented('removeClasses'); } +} +*/