{"id":16192451,"url":"https://github.com/kirandash/angular2basics","last_synced_at":"2026-05-07T14:40:04.563Z","repository":{"id":100516756,"uuid":"90515964","full_name":"kirandash/angular2basics","owner":"kirandash","description":"Angular 2 Basics","archived":false,"fork":false,"pushed_at":"2017-05-13T11:01:08.000Z","size":205,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T17:36:02.676Z","etag":null,"topics":["angular-cli","angular2","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kirandash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-07T07:26:52.000Z","updated_at":"2017-05-07T12:15:32.000Z","dependencies_parsed_at":"2023-05-15T16:00:30.208Z","dependency_job_id":null,"html_url":"https://github.com/kirandash/angular2basics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirandash%2Fangular2basics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirandash%2Fangular2basics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirandash%2Fangular2basics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirandash%2Fangular2basics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirandash","download_url":"https://codeload.github.com/kirandash/angular2basics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675609,"owners_count":20977378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular-cli","angular2","typescript"],"created_at":"2024-10-10T08:10:01.914Z","updated_at":"2025-10-29T17:18:28.187Z","avatar_url":"https://github.com/kirandash.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular 2 Project Installation with angular-cli\nInstall node latest version \u003e 6.4\nnpm install -g angular-cli\nng new angular2basics\ncd angular2basics\nng server\n\n# Project structure\ne2e - folder for end to end testing\n\napp-\napp.component.spec.ts - spec file for unit testing\napp.module.ts - a bundle telling angular what to use in the app\napp.components.css - css for only that component\n\nenvirmonents-\nenvironment variables.\n\nmain.ts- starts the angular app\nstyles.css - global style rules for entire app\n\nInstall typekit globally\nnpm install typescript -g\n\n# How Angular works\nFirst main.ts runs which bootstraps AppModule from app.module.ts which includes app.component.ts and thus app.component.ts becomes the default ts file to run\n\n# Create component\nng generate component other\nnot create a folder(flat) and use inline styles and template\nng g c another --flat --inline-styles --inline-template\nng g c another --flat -is -it\n\n# view encapsulation and shadow html\nThis can be turned off. This is what defines how css is applied to different components in angular 2\nh1[_ngcontent-qpq-0] {\n    color: red;\n}\n\n# Data binding\nString interpolation e.g. {{ expression resolves to a string }}\nProperty binding e.g. \u003cbutton [disabled]=\"expression\"\u003e\nEvent binding e.g. \u003cbutton (click)=\"expression handling the event\"\u003e\nTwo way data binding - property + event binding e.g. \u003cinput [(ngModel)] = \"bound model (e.g. object)\"\u003e\n\nng g c databinding\n\nProperty binding - 1. DOM properties: src, click, 2. Directive properties: ngClass, ngSubmit 3. Component properties: initObj, rndEvent\n\nBindings: 1. Property binding: @Input propName: string;\n2. Event binding: @Output() eventName = new EventEmitter();\nng g c property-binding --flat -it -is\nng g c two-way-binding --flat -it -is\n\n3. Two way binding:\n[(ngModel)]=\"person.age\"\n\n# Life cycle hooks\na. ngOnChanges - before b. and when data-bound property value changes\nb. ngOnInit - On compoment initialization, after first ngOnChanges\nc. ngDoCheck - During every angular 2 change detection cycle\nd. ngAfterContentInit - After inserting content\ne. ngAfterContentChecked - After every check of inserted content\nf. ngAfterViewInit - After initializing the component's views/child views\ng. ngAfterViewChecked - After every check of the component's views/child views\nh. ngOnDestroy - Just before the angular 2 destroys the directive/component\n\n# Angular2basics\n\nThis project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.28.3.\n\n## Development server\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).\nBefore running the tests make sure you are serving the app via `ng serve`.\n\n## Deploying to GitHub Pages\n\nRun `ng github-pages:deploy` to deploy to GitHub Pages.\n\n## Further help\n\nTo get more help on the `angular-cli` use `ng help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirandash%2Fangular2basics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirandash%2Fangular2basics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirandash%2Fangular2basics/lists"}