Package Exports
- @trycatch/types-extensions
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@trycatch/types-extensions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Types Extensions
This lib provide some useful functions to extend core types and some of the Angular Types
How to use it
npm install --save @trycatch/types-extensionsin your .ts file where you want to use types extensions
import "@trycatch/types-extensions";String Extensions
padZero(length: number)
let str = "trycatch";
str = str.padZero(10);
console.log("padZero string :", str);
// above will log to console - "00trycatch"AbstractControl Extensions
control(path: string): AbstractControl;
import "@trycatch/types-extensions";
@Component()
export class AppComponent {
form: FormGroup;
constructor(private fb: FormBuilder) {}
buildForm() {
this.form = this.fb.group({
firstName: ["", Validators.required],
lastName: ["", Validators.required],
address: this.fb.group({
streetNo: ["", Validators.required],
streetName: ["", Validators.required],
suburb: ["", Validators.required]
})
});
}
someOtherMethod() {
let firstNameControl = this.form.control("firstName");
let suburb = this.form.control("address.suburb");
}
}