Skip to content

Commit 11c4532

Browse files
In Angular2Spa, use angular2-template loader as a step towards AoT compilation. Implements aspnet#356
1 parent fadcb58 commit 11c4532

File tree

7 files changed

+12
-10
lines changed

7 files changed

+12
-10
lines changed

templates/Angular2Spa/ClientApp/app/components/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app',
5-
template: require('./app.component.html'),
6-
styles: [require('./app.component.css')]
5+
templateUrl: './app.component.html',
6+
styleUrls: ['./app.component.css']
77
})
88
export class AppComponent {
99
}

templates/Angular2Spa/ClientApp/app/components/counter/counter.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'counter',
5-
template: require('./counter.component.html')
5+
templateUrl: './counter.component.html'
66
})
77
export class CounterComponent {
88
public currentCount = 0;

templates/Angular2Spa/ClientApp/app/components/fetchdata/fetchdata.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Http } from '@angular/http';
33

44
@Component({
55
selector: 'fetchdata',
6-
template: require('./fetchdata.component.html')
6+
templateUrl: './fetchdata.component.html'
77
})
88
export class FetchDataComponent {
99
public forecasts: WeatherForecast[];

templates/Angular2Spa/ClientApp/app/components/home/home.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'home',
5-
template: require('./home.component.html')
5+
templateUrl: './home.component.html'
66
})
77
export class HomeComponent {
88
}

templates/Angular2Spa/ClientApp/app/components/navmenu/navmenu.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'nav-menu',
5-
template: require('./navmenu.component.html'),
6-
styles: [require('./navmenu.component.css')]
5+
templateUrl: './navmenu.component.html',
6+
styleUrls: ['./navmenu.component.css']
77
})
88
export class NavMenuComponent {
99
}

templates/Angular2Spa/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@angular/router": "3.0.2",
1414
"@types/node": "^6.0.42",
1515
"angular2-platform-node": "~2.0.11",
16+
"angular2-template-loader": "^0.6.0",
1617
"angular2-universal": "~2.0.11",
1718
"angular2-universal-polyfills": "~2.0.11",
1819
"aspnet-prerendering": "^1.0.7",
@@ -25,6 +26,7 @@
2526
"expose-loader": "^0.7.1",
2627
"extract-text-webpack-plugin": "^1.0.1",
2728
"file-loader": "^0.9.0",
29+
"html-loader": "^0.4.4",
2830
"isomorphic-fetch": "^2.2.1",
2931
"jquery": "^2.2.1",
3032
"preboot": "^4.5.2",
@@ -37,8 +39,8 @@
3739
"url-loader": "^0.5.7",
3840
"webpack": "^1.13.2",
3941
"webpack-hot-middleware": "^2.12.2",
40-
"webpack-node-externals": "^1.4.3",
4142
"webpack-merge": "^0.14.1",
43+
"webpack-node-externals": "^1.4.3",
4244
"zone.js": "^0.6.25"
4345
}
4446
}

templates/Angular2Spa/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ var sharedConfig = {
1414
},
1515
module: {
1616
loaders: [
17-
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts', query: { silent: true } },
18-
{ test: /\.html$/, loader: 'raw' },
17+
{ test: /\.ts$/, include: /ClientApp/, loaders: ['ts?silent=true', 'angular2-template'] },
18+
{ test: /\.html$/, loader: 'html' },
1919
{ test: /\.css$/, loader: 'to-string!css' },
2020
{ test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url', query: { limit: 25000 } }
2121
]

0 commit comments

Comments
 (0)