Advertisement
adaoduque

Erro

Sep 13th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. ###############################################
  2. no main.ts
  3. ###############################################
  4.  
  5. import { NgModule } from '@angular/core';
  6. import { BrowserModule } from '@angular/platform-browser';
  7. import {
  8. FormsModule,
  9. ReactiveFormsModule
  10. } from '@angular/forms';
  11.  
  12. import { AppComponent } from './app.component';
  13.  
  14. @NgModule({
  15. declarations: [
  16. AppComponent
  17. // ... our declarations here
  18. ],
  19. imports: [
  20. BrowserModule,
  21. FormsModule, // <-- add this
  22. ReactiveFormsModule // <-- and this
  23. ],
  24. bootstrap: [ AppComponent ]
  25. })
  26. class FormsDemoAppModule {}
  27.  
  28.  
  29.  
  30. ###############################################
  31. no app.component.ts
  32. ###############################################
  33.  
  34. import { Component } from '@angular/core';
  35. @Component({
  36. selector: 'my-app',
  37. template: `
  38. <div class="ui raised segment">
  39. <h2 class="ui header">Demo Form: Sku</h2>
  40. <form #f="ngForm"
  41. (ngSubmit)="onSubmit(f.value)"
  42. class="ui form">
  43.  
  44. <div class="field">
  45. <label for="skuInput">SKU</label>
  46. <input type="text"
  47. id="skuInput"
  48. placeholder="SKU"
  49. name="sku" ngModel>
  50. </div>
  51.  
  52. <button type="submit" class="ui button">Submit</button>
  53. </form>
  54. </div>
  55. `
  56. })
  57.  
  58. export class AppComponent {
  59. onSubmit(form: any): void {
  60. console.log('you submitted value:', form);
  61. }
  62. }
  63.  
  64.  
  65.  
  66. ###############################################
  67. no index.html
  68. ###############################################
  69. <!DOCTYPE html>
  70. <html>
  71. <head>
  72. <script src="node_modules/core-js/client/shim.min.js"></script>
  73. <script src="node_modules/zone.js/dist/zone.js"></script>
  74. <script src="node_modules/reflect-metadata/Reflect.js"></script>
  75. <script src="node_modules/systemjs/dist/system.src.js"></script>
  76. <script src="systemjs.config.js"></script>
  77. <script type="text/javascript">
  78. System.import('app').catch(console.log.bind(console));
  79. </script>
  80. </head>
  81. <body>
  82. <my-app></my-app>
  83. </body>
  84. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement