Advertisement
Guest User

Untitled

a guest
May 24th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. | - App
  2. | | - app.ts
  3. | | - boot.ts
  4. | | - main.ts
  5. |
  6. | - Views
  7. | | - Shared
  8. | | - _Layout.cshtml
  9. |
  10. | - systemjs.config.js
  11.  
  12. <!DOCTYPE html>
  13. <html>
  14. <head>
  15. <meta charset="utf-8" />
  16. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  17. <title>@ViewBag.Title - My ASP.NET Application</title>
  18.  
  19. <!-- Polyfill(s) for older browsers -->
  20. <script src="~/node_modules/core-js/client/shim.min.js"></script>
  21.  
  22.  
  23. @Styles.Render("~/Content/css")
  24. @Scripts.Render("~/bundles/modernizr")
  25. </head>
  26. <body>
  27. <div class="navbar navbar-inverse navbar-fixed-top">
  28. <div class="container">
  29. <div class="navbar-header">
  30. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  31. <span class="icon-bar"></span>
  32. <span class="icon-bar"></span>
  33. <span class="icon-bar"></span>
  34. </button>
  35. @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
  36. </div>
  37. <div class="navbar-collapse collapse">
  38. <ul class="nav navbar-nav">
  39. <li>@Html.ActionLink("Home", "Index", "Home")</li>
  40. <li>@Html.ActionLink("About", "About", "Home")</li>
  41. <li>@Html.ActionLink("Contact", "Contact", "Home")</li>
  42. </ul>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="container body-content">
  47. @RenderBody()
  48. <hr />
  49. <footer>
  50. <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
  51. </footer>
  52. </div>
  53.  
  54.  
  55. <script src="~/node_modules/zone.js/dist/zone.js"></script>
  56. <script src="~/node_modules/systemjs/dist/system.src.js"></script>
  57.  
  58. <script src="~/systemjs.config.js"></script>
  59. <script>
  60. System.import('app').catch(function (err) { console.error(err); });
  61. </script>
  62. @Scripts.Render("~/bundles/jquery")
  63. @Scripts.Render("~/bundles/bootstrap")
  64. @RenderSection("scripts", required: false)
  65. </body>
  66. </html>
  67.  
  68. /**
  69. * System configuration for Angular samples
  70. * Adjust as necessary for your application needs.
  71. */
  72. (function (global) {
  73. System.config({
  74. paths: {
  75. // paths serve as alias
  76. 'npm:': '../node_modules/'
  77. },
  78. // map tells the System loader where to look for things
  79. map: {
  80. // our app is within the app folder
  81. app: '../App',
  82.  
  83. // angular bundles
  84. '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
  85. '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
  86. '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
  87. '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
  88. '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
  89. '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
  90. '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
  91. '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
  92.  
  93. // other libraries
  94. 'rxjs': 'npm:rxjs',
  95. 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
  96. },
  97. // packages tells the System loader how to load when no filename and/or no extension
  98. packages: {
  99. app: {
  100. main: './main.js',
  101. defaultExtension: 'js'
  102. },
  103. rxjs: {
  104. defaultExtension: 'js'
  105. }
  106. }
  107. });
  108. })(this);
  109.  
  110. import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
  111. import { AppModule } from './boot';
  112. const platform = platformBrowserDynamic();
  113. platform.bootstrapModule(AppModule);
  114.  
  115. import { NgModule } from '@angular/core';
  116. import { BrowserModule } from '@angular/platform-browser';
  117. import { AppComponent } from './app';
  118.  
  119. @NgModule({
  120. imports: [BrowserModule],
  121. declarations: [AppComponent],
  122. bootstrap: [AppComponent]
  123. })
  124. export class AppModule { }
  125.  
  126. import { Component } from '@angular/core';
  127. @Component({
  128. selector: 'my-app',
  129. template: `
  130. <h2>My favorite skill is: {{myskills}}</h2>
  131. <p>Skill:</p>
  132. <ul>
  133. <li *ngFor="let skl of skills">
  134. {{ skl }}
  135. </li>
  136. </ul>
  137. `
  138. })
  139. export class AppComponent {
  140. title = 'ASP.NET MVC 5 with Angular 2';
  141. skills = ['MVC 5', 'Angular 2', 'TypeScript', 'Visual Studio 2015'];
  142. myskills = this.skills[1];
  143. }
  144.  
  145. @{
  146. ViewBag.Title = "Home Page";
  147. }
  148.  
  149. <my-app>Loading...</my-app>
  150.  
  151. @{
  152. ViewBag.Title = "Home Page";
  153. }
  154. @section Scripts{
  155. <script>
  156. System.import('app').catch(function (err) { console.error(err); });
  157. </script>
  158. }
  159. <my-app>Loading...</my-app>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement