https://github.com/tiago154/food-menu
Projeto de estudo de Angular. A ideia é criar uma pagina que será possível cadastrar estabelecimentos, cardápios e seus respectivos pratos.
https://github.com/tiago154/food-menu
angular cardapio json-server typescript
Last synced: 2 months ago
JSON representation
Projeto de estudo de Angular. A ideia é criar uma pagina que será possível cadastrar estabelecimentos, cardápios e seus respectivos pratos.
- Host: GitHub
- URL: https://github.com/tiago154/food-menu
- Owner: tiago154
- Created: 2021-03-06T16:15:59.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-28T18:23:18.000Z (about 4 years ago)
- Last Synced: 2025-02-05T13:53:38.578Z (4 months ago)
- Topics: angular, cardapio, json-server, typescript
- Language: TypeScript
- Homepage:
- Size: 291 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://app.netlify.com/sites/food-menu-angular/deploys)
# FoodMenu
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.1.4.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
## Adicionando Angular Material
`ng add @angular/material`
## Criando um novo component
`ng generate component components/template/header`
ou
`ng g c components/template/header`
## Conceitos Angular
### Directives
#### Attribute Directives
Altera a **aparência** e o **comportamento** de um elemento, componente ou outra diretiva
```ts
@directive({
selector: '[appRed]'
})
export class RedDirective {constructor(el: ElementRef) {
el.nativeElement.style.color = '#E35E6B'
}
}
``````html
favorite
```#### Structural Directives
Altera o layout **adicionando** e **removendo** elementos da **DOM**
```html
```
```html
-
{{ product.name }}
```
### Property Binding
```html
```
```ts
@Component({
selector: 'app-product-read',
templateUrl: './product-read.component.html',
styleUrls: ['./product-read.component.css']
})
export class HeaderComponent implements OnInit {
products: Product[]
}
```
### Event Binding
```html
Salvar
```
```ts
@Component({
selector: 'app-product-create',
templateUrl: './product-create.component.html',
styleUrls: ['./product-create.component.css']
})
export class HeaderComponent implements OnInit {
createProduct(): void {
// ....
}
}
```
### One Way Data Binding
Component -> HTML
```ts
nome: string;
```
```html
```
### Two Way Data Binding
Component <- -> HTML
```ts
nome: string;
```
```html
```
### Schematics
É um template que gera código para instruções complexas.
https://angular.io/guide/schematics
Exemplo: Podemos criar um componente de tabela, que fica responsável de mostrar uma lista de dados, com paginação e ordenação.
```sh
ng generate @angular/material:table
```