typescript如何使用服务,请参阅评论。(代码片段)

author author     2023-01-23     141

关键词:

// We have to define the constructor that angular is going to use when instanciate the class
// We have to define constructor, providers, import the class and use it

import  LoggingService  from './../logging.service'; // Import the service
import  Component, EventEmitter, Output  from '@angular/core';

@Component(
  selector: 'app-new-account',
  templateUrl: './new-account.component.html',
  styleUrls: ['./new-account.component.css'],
  providers: [LoggingService] // We have to inform angular about our dependency
)
export class NewAccountComponent 
  @Output() accountAdded = new EventEmitter<name: string, status: string>();

  // The type of the parameter must be the class of the service
  constructor(private loggingService: LoggingService) 

  onCreateAccount(accountName: string, accountStatus: string) 
    this.accountAdded.emit(
      name: accountName,
      status: accountStatus
    );
    this.loggingService.logStatusChange(accountStatus); // Use the method of the service
  

swift基础类swift实现cleanarchitecture用例,请参阅https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-arc(代

查看详情

如何防止 ServerXMLHTTP 自动跟随重定向(HTTP 303 请参阅其他响应)?

】如何防止ServerXMLHTTP自动跟随重定向(HTTP303请参阅其他响应)?【英文标题】:HowdoIpreventServerXMLHTTPfromautomaticallyfollowingredirects(HTTP303SeeOtherresponses)?【发布时间】:2010-09-1418:00:57【问题描述】:我正在使用ServerXMLHTTP来执行HTTPPOST... 查看详情

如何修复“未知网络“ganache”。有关可用网络,请参阅您的 Truffle 配置文件。”

】如何修复“未知网络“ganache”。有关可用网络,请参阅您的Truffle配置文件。”【英文标题】:Howtofix"Unknownnetwork"ganache".SeeyourTruffleconfigurationfileforavailablenetworks."【发布时间】:2019-10-3015:46:23【问题描述】:我正... 查看详情

sh一个简单的bash脚本,用于在nexus设备上缓存和测试ubuntutouch频道。请参阅https://developer.ubuntu.com/en/start/ubuntu-for-de(代

查看详情

在 TypeScript 文件中导入 Vue 组件

】在TypeScript文件中导入Vue组件【英文标题】:ImportingVuecomponentsinTypeScriptfile【发布时间】:2017-06-1912:50:17【问题描述】:我一直在尝试将Vue.js与TypeScript一起使用,但遇到了thisrepo。我在这里遇到了从TypeScript导入Vue单组件文件时... 查看详情

无法建立 SSL 连接,请参阅内部异常

...】:我正在尝试在我的.NET项目中请求SOAPWeb服务。我能够使用SoapUI连接并获得响应。但是当我尝试请求将此作为参考时ClienttosendSOAPrequestandreceiveresponse我收 查看详情

ICE 失败,您的 TURN 服务器似乎已损坏,有关详细信息,请参阅 about:webrtc

...【发布时间】:2020-05-3006:27:53【问题描述】:我正在尝试使用WebRTC查找客户端IP地址,但在Firefox中我收到此错误:varmyPeerConnection=window 查看详情

python我的文章中使用python和flask微框架构建restfulweb服务的代码。请参阅此处的文章:http://blog.miguel(代码片段)

查看详情

OSError: octave-cli 未找到,请参阅 README

...t2py我收到以下错误OSError:octave-clinotfound,请参阅README我该如何 查看详情

VSCode 和 Vue 2 插件 TypeScript 定义

】VSCode和Vue2插件TypeScript定义【英文标题】:VSCodeandVue2pluginTypeScriptdefinitions【发布时间】:2017-06-2102:13:57【问题描述】:我正在使用VSCode和TypeScript类进行Vue2组件开发。请参阅:vuejs/vue-class-component。在我当前的项目中,我使用vue... 查看详情

对 React 中如何使用接口(TypeScript)感到困惑

】对React中如何使用接口(TypeScript)感到困惑【英文标题】:Confusionwithhowinterface(TypeScript)isusedinReact【发布时间】:2020-02-1912:00:59【问题描述】:我是React中的TypeScript新手,正在学习如何将TypeScript正确集成到React项目中,并且卡... 查看详情

如何使用 TypeScript 和 Sequelize

】如何使用TypeScript和Sequelize【英文标题】:HowtouseTypeScriptwithSequelize【发布时间】:2020-05-1718:31:05【问题描述】:我已经使用Fastify用Node、PostgreSQL、Sequelize编写了我的服务器应用程序。现在我想使用TypeScript。谁能告诉我如何开始... 查看详情

错误:清单合并失败并出现多个错误,请参阅日志

...的SDK后,我注意到编译时一直发生错误,这使我无法开始使用此服务。我的build.grade(Module:app)文件:applyplugin:\'com.a 查看详情

mongodb常见问题:索引

...官方手册:​​https://www.mongodb.com/docs/manual/indexes/​​1.如何创建索引?要在集合上创建索引,请使用db.collection.createIndex()方法。创建索引是一种管理性操作。通常,应用程序不应该定期的调用db.collection.createIndex()。注意:索引... 查看详情

springcloudbus与consul

参考技术A如何激活要开始使用Consul总线,使用组org.springframework.cloud和工件idspring-cloud-starter-consul-bus的起动器。有关使用当前的SpringCloud发布列表设置构建系统的详细信息,请参阅SpringCloud项目页面。有关可用的执行机构端点以及... 查看详情

“请检查 gdb 是不是经过代码签名 - 请参阅 taskgated(8)” - 如何安装带有签名的自制代码的 gdb?

】“请检查gdb是不是经过代码签名-请参阅taskgated(8)”-如何安装带有签名的自制代码的gdb?【英文标题】:"pleasecheckgdbiscodesigned-seetaskgated(8)"-Howtogetgdbinstalledwithhomebrewcodesigned?“请检查gdb是否经过代码签名-请参阅taskgated(8)... 查看详情

服务器在处理请求时遇到错误。有关更多详细信息,请参阅服务器日志

】服务器在处理请求时遇到错误。有关更多详细信息,请参阅服务器日志【英文标题】:Theserverencounteredanerrorprocessingtherequest.Seeserverlogsformoredetails【发布时间】:2014-03-1505:46:10【问题描述】:我有一个简单的问题。我在VisualStudio... 查看详情

如何强制 VSCode 使用本地安装的 TypeScript

】如何强制VSCode使用本地安装的TypeScript【英文标题】:HowtoforceVSCodetouselocallyinstalledTypeScript【发布时间】:2019-07-1514:12:47【问题描述】:有没有办法强制VisualStudioCode在编辑该项目时使用本地安装在JS项目中的TypeScript(而不是与VS... 查看详情