Skip to content

Commit

Permalink
feat(valueAccessor): progress implementing the value accessor for rea…
Browse files Browse the repository at this point in the history
…ctive froms
  • Loading branch information
BioPhoton committed Apr 10, 2017
1 parent 0f27794 commit cd8136d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion examples/angular2/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1>
(onClick)="starRatingConfig.onClick($event)"
(onRatingChange)="starRatingConfig.onRatingChange($event)"
></star-rating-comp>

<app-form-test></app-form-test>



18 changes: 8 additions & 10 deletions examples/angular2/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { StarRatingModule } from 'angular-star-rating';


import { AppComponent } from './app.component';
import {BrowserModule} from "@angular/platform-browser";
import {NgModule} from "@angular/core";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {HttpModule} from "@angular/http";
import {StarRatingModule} from "angular-star-rating";
import {AppComponent} from "./app.component";
import {FormTestComponent} from "./components/form-test/form-test.component";


Expand All @@ -19,7 +16,8 @@ import {FormTestComponent} from "./components/form-test/form-test.component";
BrowserModule,
FormsModule,
HttpModule,
StarRatingModule
StarRatingModule,
ReactiveFormsModule
],
providers: [],
bootstrap: [AppComponent]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<form [formGroup]="form" (ngSubmit)="onSubmit()">

<!--
<div formGroupName="test">
</div>
-->
<input type="number" formControlName="ratingInput">

<input type="number" formControlName="ratingInput">
<star-rating-comp [starType]="'svg'" [labelText]="'Form Test Component'" formControlName="ratingComponent" ></star-rating-comp>

<star-rating-comp [starType]="'svg'" [labelText]="'Form Test Component'"></star-rating-comp>


<div class="stock-inventory__buttons">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from "@angular/core";
import {FormBuilder} from "@angular/forms";

@Component({
selector: 'app-form-test',
templateUrl: 'form-test.component.html',
styleUrls: ['form-test.component.css']
selector: 'app-form-test',
templateUrl: 'form-test.component.html',
styleUrls: ['form-test.component.css']
})
export class FormTestComponent implements OnInit {

form = this.fb.group({
ratingInput: this.fb.control(''),
ratingComponent: this.fb.control('')
});
form = this.fb.group({
//test: this.fb.group({
ratingInput: '',
ratingComponent: ''
//})
});

constructor(
private fb: FormBuilder
) {
constructor(private fb: FormBuilder) {

}
}

ngOnInit() {
ngOnInit() {
}

}
onSubmit() {
console.log('Submit:', this.form.value);
}

onSubmit() {
console.log('Submit:', this.form.value);
}

}
}

0 comments on commit cd8136d

Please sign in to comment.