Angular4 - primeng, ngx-bootstrap
In previous post we tried to create module, component and routing. Lets look into how to add third party libraries.
You could check out the code from here.
In Angular4 adding third party libraries is pretty easy. Install using npm and add the module. Its one of my most loved feature in Angular4.
PrimeNG
PrimeNG is one of the most used and most popular Angular4 library. It consists lot of components and its easy to setup and use. Besides it does have a good team working behind this library. In my experience it's one of the fast developing library.
To install PrimeNg run
PrimeNg needs font awesome for icons . Unlike any other libraries , PrimeNG had separate module for each component, which helps to include only selected component in the bundle.
Lets include styles for the components. In .angular-cli.json add
We are going to use Datatable to display the employee list. We have to import the module in the employee module in order to use the component. So in employee.module.ts include this add DataTableModule in imports.
In the employee-list/employee-list.component.html add
And in employee-list/employee-list.component.ts we will create an array of employee object .
employeelist:Employee[];
getEmployees(){
this.empService.getEmployees().subscribe(data=>{
console.log(data);
this.employeelist = data;
})
}
ngOnInit() {
this.getEmployees();
}
So we will call the service in an function and we will call the function in ngOnInit.
ngx-bootstrap
ngx-bootstrap is another library which uses bootstrap for styling. We are going to use the modal popup of ngx. Why? Simple its' component style makes it separate item and its responsive. Let's install ngx-bootstrap.
npm install ngx-bootstrap --save
The ngx uses the @angular/animations package for animation. So we need to install this also
npm install --save @angular/animations
We will add the ModalModule in employee.module.ts.
import { ModalModule } from "ngx-bootstrap/modal";
Next we need create the popup for the employee view. Lets create a component.
ng g c employee-view
We will add bootstrap modal template with bs-modal directive. We will have a openPop variable inside employee-view.component.ts which will use to determine whether to show the modal.
@Input and @Output is used to communicate with the component. EventEmitter is used to emit events from the component so that the parent component can listen. Why openPopChange eventemitter? Because we need to update the openPop when the use dismiss the modal by other means. The onHidden function listens to the onHidden eventEmitter for the bs-modal and it will emit the openPopChange emitter which will set the openPop false.
We will add the component in employee-list and once the user clicks on the little information button in the data list, it will set the openPop value as true and the modal will pop up.
So we added third-party libraries . See you on next post
You could check out the code from here.
git checkout -b part3.0 origin/part3.0
In Angular4 adding third party libraries is pretty easy. Install using npm and add the module. Its one of my most loved feature in Angular4.
PrimeNG
PrimeNG is one of the most used and most popular Angular4 library. It consists lot of components and its easy to setup and use. Besides it does have a good team working behind this library. In my experience it's one of the fast developing library.
To install PrimeNg run
npm install primeng --save
npm install font-awesome --save
PrimeNg needs font awesome for icons . Unlike any other libraries , PrimeNG had separate module for each component, which helps to include only selected component in the bundle.
Lets include styles for the components. In .angular-cli.json add
"styles": [ "../node_modules/bootstrap/dist/css/bootstrap.min.css", "../node_modules/font-awesome/css/font-awesome.min.css", "../node_modules/primeng/resources/primeng.min.css", "../node_modules/primeng/resources/themes/omega/theme.css", "styles.css" ],
We are going to use Datatable to display the employee list. We have to import the module in the employee module in order to use the component. So in employee.module.ts include this add DataTableModule in imports.
import { DataTableModule } from "primeng/components/datatable/datatable";
In the employee-list/employee-list.component.html add
<p-dataTable [value]="employeelist"> <p-column field="name" header="Name"> </p-column> <p-column field="department" header="Department"></p-column> <p-column field="gender" header="Gender"></p-column> <p-column> <ng-template let-col let-employee="rowData" pTemplate="body"> <button type="button" md-mini-fab (click)="selectEmployee(employee)" >
<i class="fa fa-info" aria-hidden="true"></i></button> </ng-template> </p-column> </p-dataTable>
And in employee-list/employee-list.component.ts we will create an array of employee object .
employeelist:Employee[];
getEmployees(){
this.empService.getEmployees().subscribe(data=>{
console.log(data);
this.employeelist = data;
})
}
ngOnInit() {
this.getEmployees();
}
So we will call the service in an function and we will call the function in ngOnInit.
ngx-bootstrap
ngx-bootstrap is another library which uses bootstrap for styling. We are going to use the modal popup of ngx. Why? Simple its' component style makes it separate item and its responsive. Let's install ngx-bootstrap.
npm install ngx-bootstrap --save
The ngx uses the @angular/animations package for animation. So we need to install this also
npm install --save @angular/animations
We will add the ModalModule in employee.module.ts.
import { ModalModule } from "ngx-bootstrap/modal";
Next we need create the popup for the employee view. Lets create a component.
ng g c employee-view
We will add bootstrap modal template with bs-modal directive. We will have a openPop variable inside employee-view.component.ts which will use to determine whether to show the modal.
@Input and @Output is used to communicate with the component. EventEmitter is used to emit events from the component so that the parent component can listen. Why openPopChange eventemitter? Because we need to update the openPop when the use dismiss the modal by other means. The onHidden function listens to the onHidden eventEmitter for the bs-modal and it will emit the openPopChange emitter which will set the openPop false.
We will add the component in employee-list and once the user clicks on the little information button in the data list, it will set the openPop value as true and the modal will pop up.
So we added third-party libraries . See you on next post
Comments
Angular 5 Development Company
Angular 5 Training in CHennai
Best Online Software Training Institute | Angular 4 Training
Indian Cyber Army’s most awaited internship is live now. Summer Internship 2018 on “ Ethical hacking” and book your seats before it runs out.Candidates have to get themselves registered to be a part of this Internship program. Here internship will give you on-the-job experience, help you learn whether you and Cyber security industry are a good match and can provide you with valuable connections and references. Here interns are usually exposed to a wide variety of tasks and responsibilities which allows the intern to showcase their strengths by working on projects for various managers that work on different parts of Indian Cyber Army. Becoming a high performing intern is a fantastic way to improve your employment prospects. This internship can be a great way to get your foot in the door of success with a prestigious or desirable Organization.As career in ethical hacking is most in demand.
Indian Cyber Army credibility in Ethical hacking training & Cybercrime investigation training is acknowledged across nation as we offer hands on practical knowledge and full assistance with basic as well as advanced level ethical hacking & cybercrime investigation courses. The training is conducted by subject specialist corporate professionals with wide experience in managing real-time ethical hacking/ cyber security projects. Indian Cyber Army implements a blend of academic learning and practical sessions to give the candidate optimum exposure.Ethical hacking training ,
Ethical hacking course
I can see your hardwork in this article, great work keep doing.
German Classes in Chennai
CCNA Training in Chennai
Android training
android app development course in chennai
android Training in Chennai
Java Training in Chennai
Spoken English Class in Thiruvanmiyur
Spoken English Classes in Adyar
Spoken English Classes in T-Nagar
Spoken English Classes in Vadapalani
Spoken English Classes in Porur
Spoken English Classes in Anna Nagar
Spoken English Classes in Chennai Anna Nagar
Spoken English Classes in Perambur
Spoken English Classes in Anna Nagar West
aviation training in Chennai
air hostess academy in Chennai
Airport Management Training in Chennai
airport ground staff training courses in Chennai
Aviation Academy in Chennai
air hostess training in Chennai
airport management courses in Chennai
ground staff training in Chennai
I Found this article useful same as your. you can visit by clicking java training in Hyderabad
asikqq
dewaqq
sumoqq
interqq
pionpoker
bandar ceme terbaik
hobiqq
paito warna terlengkap
syair sgp
Final Year Projects for CSE in Angular
Angular Training in Chennai
Project Centers in Chennai
JavaScript Training in Chennai
bitwise aptitude questions
how to hack flipkart legally
zenq interview questions
count ways to n'th stair(order does not matter)
zeus learning subjective test
ajax success redirect to another page with data
l&t type 2 coordination chart
html rollover image
hack android phone using cmd
how to hack internet speed upto 100mbps
internship report on python
free internship in chennai for ece students
free internship for bca
internship for computer science engineering students in india
internships in hyderabad for cse students 2018
electrical companies in hyderabad for internship
internships in chennai for cse students 2019
internships for ece students
inplant training in tcs chennai
internship at chennai
internship in chennai for ece students with stipend
internship for mechanical engineering students in chennai
inplant training in chennai
free internship in pune for computer engineering students
internship in chennai for mca
iot internships
internships for cse students in hyderabad
implant training in chennai
internship for aeronautical engineering students in bangalore
inplant training certificate
r programming training in chennai
internship in bangalore for ece students
inplant training for mechanical engineering students
summer internships in hyderabad for cse students 2019
final year project ideas for information technology
bba internship certificate
internship in bangalore for ece
internship for cse students in hyderabad
summer training for ece students after second year
robotics courses in chennai
business-executive-resume-samples
business-owner-resume-samples
business-to-business-sales-resume-sample-sales-resumes
cad-design-engineer-resume-samples
call-centre-jobs-resume-sample
ca-resume-samples-chartered-accountant-resume-format
cassandra-database-administrator-resume
category/accountant-resume
category/admin-resume
assistant-director-resume-format
director-resume-sample
assistant-professor-resume-sample
back-office-executive-resume-samples
bank-branch-manager-resume-samples
basketball-coach-resume-sample-coach-resumes
bca-fresher-resume-sample
best-general-manager-resume-example
bpo-resume-freshers-sample
bpo-resume-samples-for-freshers
civil-engineer-resume-format
client-service-executive-resume-sample
cognos-developer-resume-samples
college-lecturer-resume
college-lecturer-resume-sample
commercial-assistant-resume-sample
compliance-officer-resume-samples
computer-teacher-resume-format
computer-teacher-resume-sample
cordova-developer-resume-sample
salesforce course
devops online training in hyderabad
full stack web development course
IoT Training in Chennai
IoT courses in Chennai
German Classes in Chennai
IELTS Coaching in Chennai
top 10 ielts coaching centers in chennai
IELTS Coaching center in Chennai
Japanese Classes in Chennai
Spoken English Classes in Chennai
spoken english training in chennai
best english coaching centre in chennai
spanish classes in chennai
content writing course in chennai
IoT Training in Porur
IoT Training in Adyar
Oracle EPM Cloud & Hyperion Online Training
QlikView Certification Online Training from Hyderabad
TOGAF Online Training from India
Hyperion Essbase Planning Realtime Online Support In India
Oracle EBS R12 SCM Self-Placed Training Videos
SQL Server Integration Services(SSIS) Online Live Classes
Best Oracle Fusion Planning Central Online Certification Training India