File tree Expand file tree Collapse file tree 4 files changed +70
-0
lines changed
Expand file tree Collapse file tree 4 files changed +70
-0
lines changed Original file line number Diff line number Diff line change 1+ /// <reference path="../../../typings/_custom.d.ts" />
2+
3+ /*
4+ * Angular 2
5+ * @Component : factory function
6+ * @View : factory function
7+ * @ViewEncapsulation : ENUM How the template and styles of a view should be encapsulated.
8+ */
9+ import { Component , View , ViewEncapsulation } from 'angular2/angular2' ;
10+
11+ /*
12+ * Directives
13+ * @angularDirectives : Angular's core/form/router directives
14+ * @appDirectives : Our collection of directives from /directives
15+ */
16+ import { appDirectives , angularDirectives } from 'app/directives/directives' ;
17+
18+ // Webpack's `require` to get files
19+ let styles = require ( './styles/home.css' ) ;
20+ let template = require ( './views/home.html' ) ;
21+
22+ // Simple external file component example
23+ @Component ( {
24+ selector : 'home'
25+ } )
26+ @View ( {
27+ directives : [ angularDirectives , appDirectives ] ,
28+ encapsulation : ViewEncapsulation . EMULATED , // EMULATED: Emulate scoping of styles by preprocessing the style rules and adding additional attributes to elements.
29+ // include .html and .css file
30+ styles : [ styles ] ,
31+ template : template
32+ } )
33+ export class Home {
34+ constructor ( ) {
35+
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ .home {
2+ background-color : # F8F8F8 ;
3+ }
Original file line number Diff line number Diff line change 1+ /// <reference path="../../../../typings/_custom.d.ts" />
2+ import { Component , View } from 'angular2/angular2' ;
3+ import { Home } from './home' ;
4+
5+ @Component ( {
6+ selector : 'test-cmp'
7+ } )
8+ @View ( {
9+ directives : [ Home ]
10+ } )
11+ class TestComponent {
12+
13+ }
14+
15+ describe ( 'Home' , ( ) => {
16+ var home ;
17+
18+ beforeEach ( ( ) => {
19+ home = new Home ( ) ;
20+ } ) ;
21+
22+ it ( 'should work' , ( ) => {
23+ expect ( home ) . toBeDefined ( ) ;
24+ } ) ;
25+
26+ } ) ;
27+
Original file line number Diff line number Diff line change 1+ < div class ="home ">
2+ < h2 > Home</ h2 >
3+ </ div >
You can’t perform that action at this time.
0 commit comments