-
-
Save xgrommx/7147c67d76bf48696171 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component as _Component, Template as _Template} from 'angular2/src/core/annotations/annotations'; | |
function makeDecorator(annotationClass) { | |
return (options) => { | |
return (klass) => { | |
klass.annotations = klass.annotations || []; | |
klass.annotations.push(new annotationClass(options)); | |
return klass; | |
}; | |
}; | |
} | |
const Component = makeDecorator(_Component); | |
const Template = makeDecorator(_Template); | |
@Component({ | |
selector: 'hello' | |
}) | |
@Template({ | |
inline: '<p>Hello, World!</p>' | |
}) | |
class HelloComponent { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; | |
var _angular2SrcCoreAnnotationsAnnotations = require("angular2/src/core/annotations/annotations"); | |
var _Component = _angular2SrcCoreAnnotationsAnnotations.Component; | |
var _Template = _angular2SrcCoreAnnotationsAnnotations.Template; | |
function makeDecorator(annotationClass) { | |
return function (options) { | |
return function (klass) { | |
klass.annotations = klass.annotations || []; | |
klass.annotations.push(new annotationClass(options)); | |
return klass; | |
}; | |
}; | |
} | |
var Component = makeDecorator(_Component); | |
var Template = makeDecorator(_Template); | |
var HelloComponent = (function () { | |
function HelloComponent() { | |
_classCallCheck(this, HelloComponent); | |
} | |
HelloComponent = Component({ | |
selector: "hello" | |
})(HelloComponent) || HelloComponent; | |
HelloComponent = Template({ | |
inline: "<p>Hello, World!</p>" | |
})(HelloComponent) || HelloComponent; | |
return HelloComponent; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment