Skip to content

Instantly share code, notes, and snippets.

@machariamarigi
Created December 2, 2016 09:29
Show Gist options
  • Save machariamarigi/e7e603f9abe4cfa005cf9f7c6bb07312 to your computer and use it in GitHub Desktop.
Save machariamarigi/e7e603f9abe4cfa005cf9f7c6bb07312 to your computer and use it in GitHub Desktop.
<div class="row">
<div class="col-md-6 col-md-offset-3 well">
<form novalidate (ngSubmit)="onSubmit(listing)" [formGroup]="listing">
<label>
<span>Name</span>
<input type="text" formControlName="name" placeholder="Enter listing's name (if it has one)'">
</label>
<label>
<span>Listing Type</span>
<select formControlName="type">
<option value="all">Select a type</option>
<option *ngFor="let type of listingTypes" value="{{type.name}}">{{ type.name }}</option>
</select>
<div
class="error"
*ngIf="listing.get('type').hasError('required') && listing.get('type').touched">
Listing type is required
</div>
</label>
<label>
<span>Owner</span>
<input type="text" formControlName="owner" placeholder="Enter Your name">
</label>
<label>
<span>Price</span>
<input type="text" formControlName="price" placeholder="Enter listing's price">
<div
class="error"
*ngIf="listing.get('price').hasError('required') && listing.get('price').touched">
Listing type is required
</div>
</label>
<label>
<span>Description</span>
<input type="text-area" formControlName="description" placeholder="Give Listing's description">
</label>
<label>
<span>Location</span>
<input type="text" formControlName="location" placeholder="Enter listing's location">
<div
class="error"
*ngIf="listing.get('location').hasError('required') && listing.get('location').touched">
Listing type is required
</div>
</label>
<label>
<span>Image url 1</span>
<input type="text" formControlName="image1" placeholder="post image">
</label>
<label>
<span>Image url 2</span>
<input type="text" formControlName="image2" placeholder="post image">
</label>
<label>
<span>Image url 3</span>
<input type="text" formControlName="image3" placeholder="post image">
</label>
<button type="submit" [disabled]="listing.invalid">Post Listing</button>
</form>
{{ listing.value | json }}
</div>
</div>
@waracci
Copy link

waracci commented Dec 2, 2016

got it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment