Seeking guidance on creating a customized alert in Angular2, I am facing challenges. Here's the alert box I want to replicate: check this example
Being new to Angular2 concepts, I need assistance in integrating this code into my Angular2 application. My app has a table with a submit button, and I aim to trigger an alert upon submission.
Visual Representation:
https://i.sstatic.net/hJMm1.png
The code from my table.component.ts file:
import {Component, NgModule } from "@angular/core";
import { BrowserModule } from '@angular/platform-browser';
import {Http} from "@angular/http";
@Component({
selector: 'demo',
templateUrl: './app/table/table.component.html'
})
export class TableComponent{
public data;
constructor(private http: Http) {
}
ngOnInit(): void {
this.http.get("app/table/data.json")
.subscribe((data) => {
setTimeout(() => {
this.data = data.json();
}, 1000);
});
}
addRow() {
this.data.push({
status:''
})
}
deleteRow(index) {
this.data.splice(index,1);
}
public toInt(num: string) {
return +num;
}
public sortByWordLength = (a: any) => {
return a.city.length;
}
}
Content of my table.module.ts file:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from "@angular/forms";
import { DataTableModule } from "angular2-datatable";
import { HttpModule } from "@angular/http";
import { TableComponent } from './table.component';
import { DataFilterPipe } from './table-filter.pipe';
@NgModule({
imports: [
CommonModule,
DataTableModule,
FormsModule,
HttpModule
],
declarations: [TableComponent, DataFilterPipe],
exports: [TableComponent]
})
export class TableModule { }
Configuration details from app.module.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { TableModule } from './table/table.module';
@NgModule({
imports: [BrowserModule, TableModule],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
Struggling to implement the mentioned code into my existing setup, seeking any form of help or advice. Thank you in advance!