This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeTodo(todoList: Todo[], id: number): Todo[] { | |
throwErrors(todoList, id); | |
let newList = todoList.filter((item: Todo) => { | |
return item.id !== id | |
}) | |
return newList; | |
} | |
function toogleTodo(todoList: Todo[], id: number): Todo[] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Employee { | |
name: string; | |
role: string; | |
} | |
const list: Employee[] = [ | |
{ name: 'andreia', role: 'developer' }, | |
{ name: 'john', role: 'CEO' }, | |
{ name: 'mica', role: 'sales' }, | |
{ name: 'joana', role: 'cleaner' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function countMinimumOperations(password) { | |
let operations = 0; | |
let vowels = 0; | |
let consonants = 0; | |
// Count the number of vowels and consonants in the password | |
for (let i = 0; i < password.length; i++) { | |
const char = password[i]; | |
if ('aeiou'.includes(char)) { | |
vowels++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signals are a value that can be observed, I can call a method in the last item of an array, example. as rxjs, they can work like "follow" updates in variables, objects etc. | |
.set: set a new value for a variable and notify dependents. | |
.update: update a value based with a current value (number ) => number + 1 and return the new value | |
.mutate: catch the new value and updated it. its similar with update, the diference is .mutate doesn't return a value and mentains a history. | |
effect and computed: will receive a notify and do something about it | |
effect(() => console.log(we have ${number} dogs now! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media(hover: hover) { | |
::ng-deep .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) { | |
background-color: red !important; | |
border-radius: 0 !important; | |
} | |
::ng-deep .mat-calendar-body-today:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical) { | |
background-color: green !important; | |
border: 0 !important; | |
border-radius: 0 !important; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
observables are lazy, means that if it doesnt have a subscribe, observables cant execute the code. | |
Subject are other type of observable, they both can emit many values. | |
observables can't emit data outside itself. | |
subjects can emit multiples values outside itself. | |
example: https://stackblitz.com/edit/angular-ivy-5tnmap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sass can use directly inside @component | |
styles: [$font-size: 40em] | |
ng build doesnt need anymore of --prod flag | |
remove IE11 suppport to IE11 | |
// angular 13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ngFor, ngIf says instructs for template what to do | |
I have a list, so ngFor, loop this array and show the list | |
I have this variable, if true, ngIf, show this variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injector // it says to angular that this service or class can be use without a parameter, | |
automatize without parameter of constructor | |
example: | |
class ServiceOrOtherClass { | |
constructor(http: httpClient) { | |
} | |
} | |
Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type=text [value]="received some value"/> | |
<input type=text (keyUp)="emit some value"/> | |
<input type=text [(value)]="emit and received some value (update template "html" and component (ts file)"/> |
NewerOlder