Configure Angular2 + Webpack + Maven Sample

Configure Angular2 + Webpack in Maven build.


Build application using Angular2 with Typescript, Webpack as Module Bundler and Maven as build environment. We will also use Angular 2 with bootstrap.js and jquery.js library

What is Webpack

Webpack is a powerful module bundler. A bundle is common JavaScript file that combine html data, css data, javascript data etc in common file together and should be served to the client in a response to a single file request. 



Let's start building application using Angular2 and Typescript. 
We will use Bootstrap + Jquery with Angular2 and Typescript in our sample application.

Download application from github: Angular2WebPackMaven

How output will look like:

Angular2 Typescript files:

1. index.html
    Application single page application html file which contain placeholder to display   
    components. 

2. main.ts
    Application entry point file, this is the place where we have imported all application 
    dependencies.

    index.html is simply a template, Required javascript's, css etc are mentioned in main.ts
    Also, which module to load in placeholder is also present in main.ts 

3. app folder
    It contains application typescript files (modules, component, services, routes, models etc)

4. resources folder
    It contains application external resources like javascript, css etc that need to be bundled.

5. package.json
    A package.json file contains meta data about our app. 
    It includes list of dependencies to install for development and production environment.

6. webpack.config.js
    Webpack configuration file


Download code from link : Angular2WebPackMaven


Steps to run the application:

1. After downloading the application, run "mvn install" in home directory as shown below,
    (It will take some time to download all development dependencies)

2. For running the application, go to browser and hit 
    "http://ip:port/Angular2WebPackMaven/angular2-webpack-maven"

You may also like to see


Number Range Spinner in Angular JS

Download binary file AngularJS + REST service

What is Websocket? How Websocket works? Program on updating total count of connected Clients.

Using JQuery Datatable with AngularJS

Top 25 Multithreading Interview Questions In Java

Enjoy !!!! 

If you find any issue in post or face any error while implementing, Please comment.

Convert Binary to Decimal number

Convert Binary to Decimal number in Java. OR
Write a program to convert Binary to Decimal number in Java.


Given a Binary number, Convert it to Decimal number. Lets see what is the input and expected output.

Check whether Binary Tree is foldable or not.

Given a binary tree, Check if tree can be folded or not?Java Program to Check whether Tree is foldable.


Check whether given binary tree can be folded or not.

Lets see what is the input and expected output for better understanding on Foldable Binary Tree.

check if tree is foldable or not
Check if tree is foldable or not

Print Fibonacci series using Recursive approach in Java

Java Program to Print Fibonacci Series upto K Number.


In this post we will see how to Print Fibonacci series using Recursive approach in Java.
Example: 
Java program to print fibonacci series up to a given number k. 
Input   = 5 Output = 0, 1, 1, 2, 3

Input   = 2
Output = 0, 1

Input   = 7
Output = 0, 1, 1, 2, 3, 5, 8  

Print Fibonacci series using Iterative approach in Java

Java Program to Print Fibonacci Series upto K Number.


In this post we will see how to Print Fibonacci series using Iterative approach in Java.
Example: 
Java program to print fibonacci series up to a given number k. 
Input   = 5 Output = 0, 1, 1, 2, 3

Input   = 2
Output = 0, 1

Input   = 7
Output = 0, 1, 1, 2, 3, 5, 8  

Fibonacci series Iterative and Recursive program in Java

Java Program to print Fibonacci series. OR
Java Program to Print Fibonacci Series upto K Number. OR
Iterative Program to print Fibonacci series. OR
Recursive Program to print Fibonacci series.


What is Fibonacci Series?
Fibonacci series is series of natural number where next number is equivalent to the sum of previous two number.
Example: 
Java program to print fibonacci series up to a given number k. 
Input   = 5 Output = 0, 1, 1, 2, 3

Input   = 2
Output = 0, 1

Input   = 7
Output = 0, 1, 1, 2, 3, 5, 8  

Check if two nodes are cousins in a Binary Tree

Given two nodes in a binary tree, check if they are cousins.


Given the binary Tree and the two nodes say ‘p’ and ‘q’, determine whether the two nodes are cousins of each other or not.

Two nodes are cousins if,

  1. They are not siblings (Children of same parent). 
  2. They are on the same level.
Two nodes are cousins of each other if they are at same level and have different parents.

Lets see few example for better understanding on when two nodes are said to be cousin of each other in Binary Tree.

Find Height of node in Binary tree in Java

Get Height of Node in Binary Tree.


Given a binary tree, Find the height of a given node in Binary tree.

Let's understand what is the input and expected output.

Get Level of node in Binary Tree in Java.

Get Level of node in Binary Tree


Given a binary tree, you need to find level of a given node in the binary tree.

Let's understand what is the input and expected output.

Get Level/Height of node in binary tree

Get Level of node in Binary Tree. OR
Get Height of Node in Binary Tree.


Given a binary tree, you need to find the height of a given node in the tree.
Finding level of node of binary tree is equivalent to finding Height of node of binary tree.

Let's understand what is the input and expected output.