import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'ip-address',
templateUrl: './ip-address.component.html',
})
export class IpAddressComponent implements OnInit {
ipAddressParts: any[] = ["0", "0", "0", "0"];
tempValue;
@Input("value")
set IpAddressComponent(value: string) {
if (typeof value !== 'string' || value.indexOf('.') === -1) {
return;
}
else {
var parts = value.split(".");
for (let index in parts) {
this.ipAddressParts[index] = +parts[index];
}
}
}
get IpAddressComponent() {
return this.ipAddressParts.join(".");
}
@Output("value")
public ipAddressEmitter = new EventEmitter<string>();
constructor() { }
ngOnInit() {
}
}
Hiç yorum yok:
Yorum Gönder