SHARE
TWEET
Untitled
a guest
Oct 23rd, 2016
17
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import {Component, OnInit} from 'angular2/core';
- import {CORE_DIRECTIVES, NgClass, FORM_DIRECTIVES, Control, ControlGroup, FormBuilder, Validators} from 'angular2/common';
- class Resources {
- ResourceDescription:string;
- ResourceAddress:string;
- }
- @Component({
- selector: 'grid',
- templateUrl: 'app/ts/grid.component.html',
- styles: [`
- body
- {
- font-family:Arial;
- color:#3a3a3a;
- }
- table
- {
- border:none;
- text-align:left;
- margin-bottom:20px;
- }
- tr th
- {
- background-color: #3b97d3;
- color: #fff;
- padding: 5px;
- border-right: solid 1px #3b97d3;
- border-left: solid 1px #fff;
- }
- tr th:first-child
- {
- border-left: solid 1px #3b97d3;
- }
- tr td
- {
- padding:5px;
- padding: 5px;
- border-right: solid 1px #d4d4d4;
- }
- tr td:first-child
- {
- border-left: solid 1px #d4d4d4;
- }
- table tr:last-child td
- {
- border-bottom: solid 1px #d4d4d4;
- }
- input[type="text"]
- {
- height:20px;
- font-size:14px;
- }
- a.btn
- {
- color:#fff;
- background-color:#3b97d3;
- padding:0px 10px;
- height:26px;
- display:inline-block;
- line-height:26px;
- text-decoration:none;
- border-radius:3px;
- -moz-border-radius:3px;
- -webkit-border-radius:3px;
- cursor:pointer;
- }
- a.btn:hover
- {
- background-color:#73c7ff;
- }
- `]
- })
- export class GridComponent implements OnInit {
- resources:Resources[] = [];
- resourcesForm: ControlGroup;
- constructor(fb: FormBuilder){
- this.resources = new Resources();
- this.resourcesForm = fb.group({
- 'ResourceDescription': new Control(this.resources.ResourceDescription),
- 'ResourceAddress': new Control(this.resources.ResourceAddress)
- });
- }
- ngOnInit(){
- let firstResource : Resources = {'ResourceAddress': 'http://www.example.com', 'ResourceDescription':'Great site'};
- this.resources.push(firstResource);
- }
- AddResource(resources:Resources) {
- alert("Added " + resources.ResourceDescription + resources.ResourceAddress);
- this.resources = new Resources();
- }
- RemoveResource() {
- alert("Resources removed!");
- }
- ShowRes() {
- alert('Results' + this.resources[0]);
- }
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
