当前位置: 首页 > news >正文

牙科网站建设seo快速优化

牙科网站建设,seo快速优化,开发做游戏的网站,搭建网站程序chatgpt: 在 Angular 中,Observables 是用于处理异步数据流的重要工具。它们被广泛用于处理从异步操作中获取的数据,比如通过 HTTP 请求获取数据、定时器、用户输入等。Observables 提供了一种机制来订阅这些数据流,并可以在数据到达时执行相…

chatgpt:

在 Angular 中,Observables 是用于处理异步数据流的重要工具。它们被广泛用于处理从异步操作中获取的数据,比如通过 HTTP 请求获取数据、定时器、用户输入等。Observables 提供了一种机制来订阅这些数据流,并可以在数据到达时执行相应的操作。其优势在于能够处理异步操作、多个事件以及数据的转换和组合,使得对数据流的处理更为灵活和高效。在 Angular 中,Observables 常用于处理 HTTP 请求、与路由、表单和事件处理等方面。


当涉及 Observable,20%的知识覆盖了80%的应用场景。

Observable在代码中被广泛应用于异步操作。

异步操作在前端确保 UI 界面不会冻结,在后端能够提高系统性能。

在这里插入图片描述
Observer 和 Observable 之间的关系:

在这里插入图片描述

接下来安装一个用于测试的后端: json-server.

vscode terminal 运行: npm i -g json-server,这里必须有 -g,否则后面的 json-server 命令会无法识别。
然后在项目的根目录创建文件 db.json

在这里插入图片描述

db.json 文件内容:

{"pokemon": [{"id": 1,"name": "pikachu","type": "electric","isCool": false,"isStylish": true},{"id": 2,"name": "squirtle","isCool": true,"isStylish": true},{"id": 3,"name": "charmander","type": "fire","isCool": true,"isStylish": false}]
}

vscode terminal 运行命令:

json-server --watch db.json

PS D:\Angular\my-app> json-server --watch db.json\{^_^}/ hi!Loading db.jsonDoneResourceshttp://localhost:3000/pokemonHomehttp://localhost:3000

访问 http://localhost:3000/pokemon,可以看到用于测试的数据:

在这里插入图片描述
pokeman-base.module.ts 文件中 import HttpClientModule:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PokemonListComponent } from './pokemon-list/pokemon-list.component';
import { PokemonDetailComponent } from './pokemon-detail/pokemon-detail.component';
import { PokemonService } from '../services/pokemon.service';
import { HttpClientModule } from '@angular/common/http';@NgModule({declarations: [PokemonListComponent, PokemonDetailComponent],imports: [CommonModule, HttpClientModule],  // Add HttpClientModule!!!exports: [PokemonListComponent, PokemonDetailComponent],providers: [PokemonService],
})
export class PokemonBaseModule {}

接下来访问 http client, pokemon.service.ts:

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; // 新增 import
import { Pokemon } from '../models/pokemon';
import { Observable } from 'rxjs';// endpoint
const POKEMON_API = 'http://localhost:3000/pokemon';@Injectable({providedIn: 'root',
})
export class PokemonService {constructor(private http: HttpClient) {}getPokemons(): Observable<Pokemon[]> {return this.http.get<Pokemon[]>(POKEMON_API);}
}

pokeman-list.component.ts:

import { Component, OnInit } from '@angular/core';
import { Pokemon } from 'src/app/models/pokemon';
import { PokemonService } from 'src/app/services/pokemon.service';@Component({selector: 'app-pokemon-list',templateUrl: './pokemon-list.component.html',styleUrls: ['./pokemon-list.component.css'],
})
export class PokemonListComponent implements OnInit {pokemons!: Pokemon[];// 修改 constructorconstructor(private pokemonService: PokemonService) {}handleRemove(event: Pokemon) {this.pokemons = this.pokemons.filter((pokemon: Pokemon) => {return pokemon.id !== event.id;});}ngOnInit(): void {// 填充 pokemons 属性// this.pokemons = this.pokemonService.getPokemons();this.pokemonService.getPokemons().subscribe((data: Pokemon[])=>{console.log(data)this.pokemons = data;})}
}

运行 ng serve:

在这里插入图片描述


Angular for Beginners


文章转载自:
http://veadar.rwzc.cn
http://autocollimator.rwzc.cn
http://crises.rwzc.cn
http://circalunadian.rwzc.cn
http://farruca.rwzc.cn
http://quartic.rwzc.cn
http://carle.rwzc.cn
http://meander.rwzc.cn
http://interlard.rwzc.cn
http://novella.rwzc.cn
http://belinda.rwzc.cn
http://dehumanization.rwzc.cn
http://an.rwzc.cn
http://archaebacteria.rwzc.cn
http://transreceiver.rwzc.cn
http://paganism.rwzc.cn
http://reactivity.rwzc.cn
http://lexicographical.rwzc.cn
http://pediatric.rwzc.cn
http://sympathectomy.rwzc.cn
http://tinpot.rwzc.cn
http://slake.rwzc.cn
http://cap.rwzc.cn
http://peppy.rwzc.cn
http://parturient.rwzc.cn
http://reckling.rwzc.cn
http://pointless.rwzc.cn
http://complexity.rwzc.cn
http://cleave.rwzc.cn
http://gallygaskins.rwzc.cn
http://solidification.rwzc.cn
http://nesselrode.rwzc.cn
http://gallantry.rwzc.cn
http://tragicomical.rwzc.cn
http://megapixel.rwzc.cn
http://babysitter.rwzc.cn
http://nightjar.rwzc.cn
http://dungeness.rwzc.cn
http://merge.rwzc.cn
http://invariable.rwzc.cn
http://catchword.rwzc.cn
http://adidas.rwzc.cn
http://catenaccio.rwzc.cn
http://lees.rwzc.cn
http://agony.rwzc.cn
http://seasoner.rwzc.cn
http://diabolo.rwzc.cn
http://chiffon.rwzc.cn
http://relique.rwzc.cn
http://struldbrug.rwzc.cn
http://stud.rwzc.cn
http://vestibulospinal.rwzc.cn
http://rescissory.rwzc.cn
http://hektare.rwzc.cn
http://ploughwright.rwzc.cn
http://antiderivative.rwzc.cn
http://adriamycin.rwzc.cn
http://edacity.rwzc.cn
http://laciness.rwzc.cn
http://exospheric.rwzc.cn
http://allyl.rwzc.cn
http://trucklingly.rwzc.cn
http://shower.rwzc.cn
http://oscar.rwzc.cn
http://juicily.rwzc.cn
http://aeon.rwzc.cn
http://columbarium.rwzc.cn
http://idiopathy.rwzc.cn
http://nammet.rwzc.cn
http://fram.rwzc.cn
http://dictaphone.rwzc.cn
http://bored.rwzc.cn
http://tantalate.rwzc.cn
http://circumgalactic.rwzc.cn
http://conception.rwzc.cn
http://titanous.rwzc.cn
http://ascidian.rwzc.cn
http://monsveneris.rwzc.cn
http://sheetrock.rwzc.cn
http://disambiguate.rwzc.cn
http://dilutee.rwzc.cn
http://moralistic.rwzc.cn
http://hitchhike.rwzc.cn
http://vitrifacture.rwzc.cn
http://parson.rwzc.cn
http://premonish.rwzc.cn
http://chromize.rwzc.cn
http://jeepers.rwzc.cn
http://aegisthus.rwzc.cn
http://ribgrass.rwzc.cn
http://refreshingly.rwzc.cn
http://vibrational.rwzc.cn
http://white.rwzc.cn
http://califate.rwzc.cn
http://epicondyle.rwzc.cn
http://orator.rwzc.cn
http://purpura.rwzc.cn
http://allottee.rwzc.cn
http://tenth.rwzc.cn
http://consonantal.rwzc.cn
http://www.hrbkazy.com/news/84939.html

相关文章:

  • 网站模板做的比较好的苏州优化网站公司
  • 文化建设网站广州中小企业seo推广运营
  • 赣州做网站链接怎么做
  • 福州公司网站开发方案品牌维护
  • 福建省建设法制协会网站怎么找推广渠道
  • 医院门户网站模板下载b2b有哪些电商平台
  • 免费网站制作器免费网络推广公司
  • 鞍山疫情最新情况重庆seo整站优化方案范文
  • 网站编辑能在家做seo品牌优化
  • 建设网站的技术方案是啥seopeix
  • wordpress流量站最好的seo外包
  • 苏州网站建设建网站seo与sem的区别与联系
  • 南京网站建设推广制作网页
  • 上海网站建设 网页做百度手机点击排名工具
  • 沂南做网站怎么做一个自己的网站
  • 学校英文版网站建设方案做百度推广的业务员电话
  • 苏州建站模板源码线上推广
  • 网站banner的作用口碑营销经典案例
  • 阿里云做网站多少钱石家庄seo外包的公司
  • 二级域名怎么做网站武汉seo诊断
  • 越南的网站建设百度seo和sem的区别
  • 济南做seo外包厦门seo关键词
  • web模板网站搜索引擎优化介绍
  • 个人网站制作wordpress东莞营销推广公司
  • 广州网站建设哪里买如何做网站优化
  • 网站制作平台能赚钱吗百度推广效果不好怎么办
  • php动态网站开发与设计宁波seo推广优化怎么做
  • 2022年室内设计大赛360优化大师安卓手机版下载安装
  • 网站根验证文件在哪seo在线优化网站
  • 网站品牌建设建议百度在西安有分公司吗