Tuesday, January 14, 2020

vendor.bundle.js size is around 10 MB when we deployed angular 6 project.

Hi All,

when you are new in angular so this is the correct place for you here we will learn how to deploy our angular project.

1st used

ng build

ng build --prod --aot

ng build --prod --aot --vendor-chunk --common-chunk --delete-output-path --buildOptimizer


Thank you Hope it is useful for you.

wagah border (entertainment)

Hi Friend ,

Today i am upload videos from wagah boarder.




Tuesday, January 7, 2020

How to enable developer mode windows 10?

If you want to activate developer mode in window 10 you are in the correct place.

Let's start

Go to Windows Settings



When you click on settings the below window is open.

Click on the "update and security" tab the below screen see than click on "For developers" tab Than you can able to see all mode.
Thank you hope it helps you .

TypeScript: sleep a thread

Hi All,

Today i am stuck in one functionality so using the thread in typescript i a solve it so thing share Knowledge to all people.

Sometimes you see within the second your method code is executed and you not understand how to stop our method so the simple idea is to use thread.

If we need to sleep e thread, we can implements a delay method that returns a Promise object (which represents the eventual completion, or failure, of an asynchronous operation, and its resulting value) and through the setTimeout method (that sets a timer which executes a function or specified piece of code once after the timer expires) resolve the Promise.

private delay(ms: number)
{
  return new Promise(resolve => setTimeout(resolve, ms));
}


Now we can call the delay method where we need to sleep the thread. To call the delay function we have to use the keyword await, so we must declare the method where we will make the call as async.

async downloadMyFile(id: number) {
    this.isLoadingSpring = true;
    const link = document.createElement('a');
    link.setAttribute('target', '_blank');
    link.setAttribute('href', '/assets/files/' + id + '/Year-Book.pdf');
    await link.setAttribute('download', 'Year-Book.pdf');
    document.body.appendChild(link);
    link.click();
    link.remove();
    await this.delay(3000);
    this.isLoadingSpring = false;
  }


Thank you for your valuable time hope it will help you 

Sunday, December 29, 2019

angular installation guide

Hi All,

This is an installation guide of angular.
Before creating our first Angular app, first, we’ll see how to install Angular on a Windows system.

Step 1 - Install NodeJS
Follow the link - https://nodejs.org/en/download/
Download the node.js installer for Windows and install it.

To check the installed version of Node.js, open the command prompt.
Type the “npm -v” command to check the Node.js installation and version.

Step 2 - Install TypeScript
Open the link https://www.npmjs.com/package/typescript

Copy the above command “npm install -g typescript” and run it on command prompt.
Step 3 - Install Angular CLI (Angular command line interface)
Open the link https://cli.angular.io/ and follow the instructions to install Angular CLI and to create your first  Angular app.
1)Type the command “npm install -g @angular/cli” on the command prompt and press enter to install Angular cli.
2)Type “ng new hello-world” and hit enter to create the Hello World app.

Thank you,
Arjun Walmiki

Saturday, November 23, 2019

How To Add JavaScript to HTML

Introduction:-

When working with files for the web, JavaScript needs to be loaded and run alongside HTML markup. This can be done either inline within an HTML document or in a separate file that the browser will download alongside the HTML document.
This tutorial will go over how to incorporate JavaScript into your web files, both inline into an HTML document and as a separate file.

Adding JavaScript into an HTML Document

You can add JavaScript code in an HTML document by employing the dedicated HTML tag <script> that wraps around JavaScript code.
The <script> tag can be placed in the <head> section of your HTML, in the <body> section, or after the </body> close tag, depending on when you want the JavaScript to load.
Generally, JavaScript code can go inside of the document <head> section in order to keep them contained and out of the main content of your HTML document.
However, if your script needs to run at a certain point within a page’s layout — like when using document.write to generate content — you should put it at the point where it should be called, usually within the <body> section.
Let’s consider the following blank HTML document with a browser title of Today's Date:
index.html
<!DOCTYPE html>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Today's Date</title>
</head>

<body>

</body>

</html>
Right now, this file only contains HTML markup. Let’s say we would like to add the following JavaScript code to the document:
let d = new Date();
alert("Today's date is " + d);
This will enable the webpage to display an alert with the current date regardless of when the user loads the site.
In order to achieve this, we will add a <script> tag along with some JavaScript code into the HTML file.
To begin with, we’ll add the JavaScript code between the <head> tags, signalling the browser to run the JavaScript script before loading in the rest of the page. We can add the JavaScript below the <title> tags, for instance, as shown below:
index.html
<!DOCTYPE html>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Today's Date</title>
    <script>
        let d = new Date();
        alert("Today's date is " + d);
    </script>
</head>

<body>

</body>



</html>
Once you load the page, you will receive an alert that will look similar to this:
JavaScript Alert Example
You can also experiment with putting the script either inside or outside the <body> tags and reload the page. As this is not a robust HTML document, you likely will not notice any difference in the loading of the page.
If we were modifying what is shown in the body of the HTML, we would need to implement that after the <head> section so that it displays on the page, as in the example below:
index.html
<!DOCTYPE html>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Today's Date</title>
</head>

<body>

  <script>
      let d = new Date();
      document.body.innerHTML = "<h1>Today's date is " + d + "</h1>"
  </script>

</body>

</html>
The output for the above HTML document loaded through a web browser would look similar to the following:
JavaScript Date Example
Scripts that are small or that run only on one page can work fine within an HTML file, but for larger scripts or scripts that will be used on many pages, it is not a very effective solution because including it can become unwieldy or difficult to read and understand. In the next section, we’ll go over how to handle a separate JavaScript file in your HTML document.
We can start with our previous HTML template from the section above:
index.html
<!DOCTYPE html>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Today's Date</title>
</head>

<body>

</body>

</html>
Now, let’s move our JavaScript code that will show the date as an <h1> header to the script.js file:
script.js
let d = new Date();
document.body.innerHTML = "<h1>Today's date is " + d + "</h1>"
We can add a reference to this script to or below the <body> section, with the following line of code:
<script src="js/script.js"></script>
The <script> tag is pointing to the script.js file in the js/ directory of our web project.
Let’s look at this line in the context of our HTML file, in this case, below the <body> section:
index.html
<!DOCTYPE html>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Today's Date</title>
</head>

<body>

</body>

<script src="js/script.js"></script>

</html>
Thank you ..............

Wednesday, November 13, 2019

How to pass data from one component to another in angular

In this blog, I am going to explain to you about component communication in angular 2,4,6.

When the parent component wants to communicate child subcomponent or vice-versa so service is a good option. 

@Input
Angular provides us @Input decorator by using that we can pass data from parent component to child component. Let's see an example

child.component.ts