Typescript Interface [Typescript Tutorial]

Typescript Interface [Typescript Tutorial]

An Interface is a description that defines specific methods that implements a class. Again, open your integrated terminal then type ng g interface <interfaceName> An Interface named Security is generated and ready for editing. A sample interface

To use your interface, first you have to choose a class that will implement your interface. Let’s…

Bootstrap 4 Navbar [Angular Tutorial]

Bootstrap 4 Navbar [Angular Tutorial]

Let’s try to add this navigation bar to our Angular 2 App. Going back to your browser, search for bootstrap 4 navbar and click this. In here, you can find different kinds of a navbar. A very simple one looks like this:

Another one is the Collapsible Content navbar. It has a customizable dropdown…

TypeScript Classes [Typescript Tutorial]

TypeScript Classes [Typescript Tutorial]

The following is a simple TypeScript class defined. With TypeScript, unlike native JavaScript, there is a native class keyword. The following snippet illustrates a simple TypesScript class definition:

Unlike the native JavaScript, TypeScript has a native class keyword. A public member, fullname and a public constructor that acquire three arguments: first, middle and last…

Your First TypeScript File [Typescript Tutorial]

Your First TypeScript File [Typescript Tutorial]

TypeScript requires extensions for its files. It uses either “.ts” or “.d.ts” // setBackgroundColor.ts. function setBackgroundColor() {     document.body.style.backgroundColor = “rgb(255,0,0)”; }     setBackgroundColor(); You might notice that it’s very similar to JavaScript. That’s because it is. Remember TypeScript is a superset of JavaScript. Pure JavaScript and the features of TypeScript that are declarative can be…