Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- | - App
- | | - app.ts
- | | - boot.ts
- | | - main.ts
- |
- | - Views
- | | - Shared
- | | - _Layout.cshtml
- |
- | - systemjs.config.js
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>@ViewBag.Title - My ASP.NET Application</title>
- <!-- Polyfill(s) for older browsers -->
- <script src="~/node_modules/core-js/client/shim.min.js"></script>
- @Styles.Render("~/Content/css")
- @Scripts.Render("~/bundles/modernizr")
- </head>
- <body>
- <div class="navbar navbar-inverse navbar-fixed-top">
- <div class="container">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
- </div>
- <div class="navbar-collapse collapse">
- <ul class="nav navbar-nav">
- <li>@Html.ActionLink("Home", "Index", "Home")</li>
- <li>@Html.ActionLink("About", "About", "Home")</li>
- <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
- </ul>
- </div>
- </div>
- </div>
- <div class="container body-content">
- @RenderBody()
- <hr />
- <footer>
- <p>© @DateTime.Now.Year - My ASP.NET Application</p>
- </footer>
- </div>
- <script src="~/node_modules/zone.js/dist/zone.js"></script>
- <script src="~/node_modules/systemjs/dist/system.src.js"></script>
- <script src="~/systemjs.config.js"></script>
- <script>
- System.import('app').catch(function (err) { console.error(err); });
- </script>
- @Scripts.Render("~/bundles/jquery")
- @Scripts.Render("~/bundles/bootstrap")
- @RenderSection("scripts", required: false)
- </body>
- </html>
- /**
- * System configuration for Angular samples
- * Adjust as necessary for your application needs.
- */
- (function (global) {
- System.config({
- paths: {
- // paths serve as alias
- 'npm:': '../node_modules/'
- },
- // map tells the System loader where to look for things
- map: {
- // our app is within the app folder
- app: '../App',
- // angular bundles
- '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
- '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
- '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
- '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
- '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
- '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
- '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
- '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
- // other libraries
- 'rxjs': 'npm:rxjs',
- 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
- },
- // packages tells the System loader how to load when no filename and/or no extension
- packages: {
- app: {
- main: './main.js',
- defaultExtension: 'js'
- },
- rxjs: {
- defaultExtension: 'js'
- }
- }
- });
- })(this);
- import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
- import { AppModule } from './boot';
- const platform = platformBrowserDynamic();
- platform.bootstrapModule(AppModule);
- import { NgModule } from '@angular/core';
- import { BrowserModule } from '@angular/platform-browser';
- import { AppComponent } from './app';
- @NgModule({
- imports: [BrowserModule],
- declarations: [AppComponent],
- bootstrap: [AppComponent]
- })
- export class AppModule { }
- import { Component } from '@angular/core';
- @Component({
- selector: 'my-app',
- template: `
- <h2>My favorite skill is: {{myskills}}</h2>
- <p>Skill:</p>
- <ul>
- <li *ngFor="let skl of skills">
- {{ skl }}
- </li>
- </ul>
- `
- })
- export class AppComponent {
- title = 'ASP.NET MVC 5 with Angular 2';
- skills = ['MVC 5', 'Angular 2', 'TypeScript', 'Visual Studio 2015'];
- myskills = this.skills[1];
- }
- @{
- ViewBag.Title = "Home Page";
- }
- <my-app>Loading...</my-app>
- @{
- ViewBag.Title = "Home Page";
- }
- @section Scripts{
- <script>
- System.import('app').catch(function (err) { console.error(err); });
- </script>
- }
- <my-app>Loading...</my-app>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement