我想创建包含其他自定义控件的自定义控件,并使用连接所有自定义控件的ngModel.喜欢 :
PersonSearchComponent:
所以现在我有工作版本,但我认为我做了一些坏事(也许我应该使用FormBuilder):
PersonSearch模板:
<div>
<developer-search-control [(ngModel)]="searchModel.developerSearchModel"></developer-search-control>
<building-search-control [(ngModel)]="searchModel.buildingSearchModel"></building-search-control>
<country-select [(ngModel)]="searchModel.countryModel"><country-select>
</div>
Run Code Online (Sandbox Code Playgroud)
ParentSearch组件
...
export class PersonSearch {
@Output() searchDataEmitter= new EventEmitter();//Exports data to above component which contains this, and listComponent
searchModel : PersonSearchModel : new PersonSearchModel();
performSearch()
{
//gets data from service with searchModel and searchDataEmitter transpors it to above component
}
}
Run Code Online (Sandbox Code Playgroud)
型号:PersonSearchModel:
developerSearchModel : DeveloperSearchModel = …Run Code Online (Sandbox Code Playgroud) 我想通过调用由 IS 验证的单独 api 将电子邮件服务与身份服务器项目分开。
我的问题是从身份服务器调用 api。目前,我在 IdentityServer 中有额外的“假”客户端正在调用 api。
这是客户端凭据流程的标准选项。
但我想省略客户端。所以IdentityServer是客户端。我在 IS 内部创建了一个“假”客户端,我认为这是错误的做法?
IdentityServer 内的 MessageService.cs
// Authenticating the fake client
var disco = await DiscoveryClient.GetAsync("http://localhost:5000");
var tokenClient = new TokenClient(disco.TokenEndpoint, "MailApiClient", "secret");
var tokenResponse = await tokenClient.RequestClientCredentialsAsync("EmailScope");
// Setting the token
client.SetBearerToken(tokenResponse.AccessToken);
var content = new StringContent(JsonConvert.SerializeObject(someMailModel));
// Posting to api
var response = await client.PostAsync(_emailSettings.RequestUri, content).ConfigureAwait(false);
Run Code Online (Sandbox Code Playgroud)
假客户端通过 IS 进行身份验证,然后将带有令牌的消息发送到 mailapi。我希望 IS 本身就是客户端,而不是在 IS 内部创建假客户端。因此IdentityServer将在没有中间件客户端的情况下调用api。
将来其他一些客户端也将使用 MailApi。