An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

        

[![Netlify Status](https://api.netlify.com/api/v1/badges/025bcd66-207c-4432-b6f2-8c16e9c11652/deploy-status)](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
```