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
const generateImage = async () => { | |
const imageParameters = { | |
prompt: userPrompt, | |
n: 1, | |
size: "256x256", | |
} | |
const response = await openai.createImage(imageParameters); | |
const urlData = response.data.data[0].url | |
console.log(urlData); | |
setImageUrl(urlData); |
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 App() { | |
const [userPrompt, setUserPrompt] = useState("") | |
const [imageUrl, setImageUrl] = useState("") | |
return ( | |
<div className="App"> | |
{ | |
imageUrl | |
? <img src={imageUrl} className="image" alt="ai thing" /> | |
: <img src={logo} className="image" alt="logo" /> |
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
import * as React from 'react'; | |
import { StrictMode } from 'react'; | |
import { createRoot } from 'react-dom/client'; | |
import App from './App'; | |
const rootElement = document.getElementById('root'); | |
const root = createRoot(rootElement); | |
root.render( |
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
import { Component, OnInit } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
@Component({ | |
selector: 'my-app', | |
template: ` | |
<h1>{{ title }}</h1> | |
`, | |
}) | |
export class AppComponent implements OnInit { |
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
import { Component, OnInit } from '@angular/core'; | |
import * as jsonData from '../assets/data.json'; | |
@Component({ | |
selector: 'my-app', | |
template: ` | |
<h1>{{ title }}</h1> | |
`, | |
}) | |
export class AppComponent implements OnInit { |
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
<div> | |
<form (ngSubmit)="onSubmit()" [formGroup]="reactiveForm"> | |
<div> | |
<label for="name">Name</label> | |
<input id="name" type="text" formControlName="name" /> | |
</div> | |
<div> | |
<label for="email">Email</label> | |
<input type="email" id="email" formControlName="email" /> | |
</div> |
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
import { Pipe, PipeTransform } from '@angular/core'; | |
import { User } from './model'; | |
@Pipe({ | |
name: 'filter', | |
}) | |
export class FilterPipe implements PipeTransform { | |
transform(value: User[], filterString: string, property: string): User[] { | |
if (value.length === 0 || !filterString) { | |
return value; |
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
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'filter' | |
}) | |
export class FilterPipe implements PipeTransform { | |
transform(value: any, args?: any): any { | |
return null; | |
} |
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
import { Component } from '@angular/core'; | |
import { FormControl, FormGroup } from '@angular/forms'; | |
@Component({ | |
selector: 'profile', | |
templateUrl: './profile.component.html', | |
styleUrls: ['./profile.component.css'], | |
}) | |
export class ProfileComponent { | |
profileForm = new FormGroup({ |
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
import { Component } from '@angular/core'; | |
import { TodoService } from './todo.service'; | |
import { map } from 'rxjs/operators'; | |
interface ToDo { | |
userId: number; | |
id: number; | |
title: string; | |
completed: boolean; | |
} |
NewerOlder