2/8/20

Angular Basic Concepts - Part 2

typescript

typescript is super set of javascript. classes, interfaces.

Strong typed language that is not like javascript. typescript if you define certain numbeer, string or something else. but we don't do this vanilla javascript. because that is dynamic typing. you have a string veriable and then you can assign a number and that's totally fine. That won't work typescript.typescript give you an error and therefore it allows you to write much more robust code which gets checked at the time you write it.

however, typescript doesn't run in the browser. So it is compiled to javascript in the end. this compilation is handle bt cli. this compilisation is realy fast and therefore in the end in the browser javascript is going to run.

We'rewriting the angular app in javascript though because, whilst technically possible that wouldn't be much fun.

Typescript a lot of the features really only exist in TypeScript and Angular is meat to be used together with typescript.


directive

-build-in directive
-your own diretctive

<input type="text" [(ngModel)]="name" />
<p>{{ name }}</p>


A Basic Project Setup using Bootstrap for Styling

open terminal and ctrl + c.
type command

npm install --save bootstrap
npm install --save bootstrap@latest
npm install --save bootstrap@3

after installation add styles in angular.json file that file has node_modules/bootstrap/dist/css/bootstrap.min.css

then run app
ng serve 


typescript wrap and module

class ClassNormal{
}
we can only acsess the class this file.

export class ExportedClass{
}
We can able to use it other files.

Modularity (Module):
System load our js files which are different part lives.






No comments:

Post a Comment

About

Hi, I'm Najathi.
I've started entrepreneurial company, Twin Brothers.Inc.
One is self-funded & the other is venture backed. I also send a weekly. where I share relevent, curated links.

Every Week I Publish a short post on writing, publishing, or content of IT Related

Contact Form

Name

Email *

Message *