This file contains hidden or 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
| const completedTasksCount = computed(() => { | |
| const tasks = getAllTasks(); | |
| return tasks.filter(task => task.isCompleted).length; | |
| }); |
This file contains hidden or 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
| decrement(): void { | |
| this.mySignal.update(signal => signal ? signal - 1 : 0); | |
| } |
This file contains hidden or 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
| mySignal.set(3); |
This file contains hidden or 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
| template: ` | |
| <p>Valeur de notre signal : {{ mySignal() }}</p> | |
| `, |
This file contains hidden or 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
| mySignal = signal(2); |
This file contains hidden or 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
| import { signal } from '@angular/core'; |
This file contains hidden or 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
| constructor(private ref: ChangeDetectorRef) { | |
| setInterval(() => { | |
| this.number ++ | |
| this.ref.markForCheck(); | |
| }, 1000) | |
| } |
This file contains hidden or 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
| import { ChangeDetectionStrategy, Component} from '@angular/core'; | |
| @Component({ | |
| selector: 'app-my-component', | |
| templateUrl: './my-component.html', | |
| changeDetection: ChangeDetectionStrategy.OnPush, | |
| standalone: true | |
| }) | |
| export class MyComponent { | |
| // votre code ... |
This file contains hidden or 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
| const listMsg = countMsg > 0 ? | |
| (msg.me.map((item, key) => <div className='chat_bot_content-msg'><h2 className='chat_bot-msg'>Moi :</h2><p className='chat_bot-msg' key={item.key}>{item}</p> | |
| <h2 className='chat_bot-msg'>Bot :</h2> {msg.bot[key]}</div>)) | |
| : (<p></p>) | |
| return ( | |
| <div> | |
| <h1 className='title'>Chat Bot</h1> | |
| <div className="chat_bot" id="chat_bot"> | |
| <div className='chat_bot_content-msg' id='chat_bot_content-msg'> |
This file contains hidden or 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
| import postMessage from '../server/postMessage.js'; | |
| ... | |
| async function handleClick(e) { | |
| e.preventDefault(); | |
| setCountMsg(countMsg + 1); | |
| const response = await postMessage(newMsg); | |
| setMsg({ 'me': msg.me.concat(newMsg), 'bot': msg.bot.concat(response.content[0].text) }) | |
| setNewMsg(''); |
NewerOlder