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 { computed, Injectable, signal } from '@angular/core'; | |
| @Injectable({ | |
| providedIn: 'root', | |
| }) | |
| export class Productstore { | |
| private _count = 0; | |
| private CountSignal = signal(this._count); |
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 os | |
| from dotenv import load_dotenv | |
| from openai import OpenAI | |
| import requests | |
| from langchain_openai import ChatOpenAI | |
| from langchain.schema import HumanMessage | |
| from langchain_core.messages import AIMessage, SystemMessage | |
| from langchain_core.prompts import PromptTemplate | |
| load_dotenv() |
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 { Component, OnInit, signal } from '@angular/core'; | |
| interface LightColor { | |
| id: number; | |
| name: string; | |
| hex: string; | |
| } | |
| const template = ` | |
| <h1>light demo </h1> |
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
| searchId = signal<string>(this.searchTerm); | |
| productResource = resource({ | |
| params: () => ({ id: this.searchId() }), | |
| loader: async (param) => { | |
| const { id } = param.params as { id: string }; | |
| console.log('Loading product with id:', id); | |
| let a = await fetch(`http://localhost:3000/product/${id}`) | |
| .then(response => response.json() as Promise<IProduct>) |
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
| // There are four types of databibding in Angular | |
| // Interpolation - one way data binding - data flows from component to view ={{data}} Display data | |
| // Property Binding - one way data binding - data flows from component to view = [property]="data" Set element property value | |
| // event binding - one way data binding - data flows from view to component = (event)="expression" Respond to user events | |
| // two way data binding - two way data binding - data flows from component to view and view to component = [(ngModel)]="data" Respond to user events and update properties |
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 { Component, HostListener, OnInit, ViewContainerRef } from '@angular/core'; | |
| @Component({ | |
| selector: 'app-home', | |
| templateUrl: './home.component.html', | |
| styleUrls: ['./home.component.css'] | |
| }) | |
| export class HomeComponent implements OnInit { | |
| count = 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
| import { Injectable } from '@angular/core'; | |
| import { RootInjectorGuard } from './root-injector.guard'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class AppService extends RootInjectorGuard { | |
| constructor() { | |
| super(AppService) |
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 { inject, InjectOptions, Type } from "@angular/core"; | |
| export class RootInjectorGuard { | |
| option: InjectOptions = { | |
| skipSelf: true, | |
| optional: true | |
| }; | |
| constructor(type: Type<any>) { | |
| console.log(type.name); | |
| const parent = inject(type, this.option); |
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
| @Component({ | |
| selector: 'app-fipq', | |
| templateUrl: './fipq.component.html', | |
| styleUrls: ['./fipq.component.css'], | |
| providers: [AppService] | |
| }) | |
| export class ProductComponent implements OnInit { | |
| constructor(private appservice: AppService) { } |
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 { Injectable } from '@angular/core'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class AppService { | |
| constructor() { } | |
| } |
NewerOlder