所以我想做一个共享相同 formControlName 的自定义无线电组件。单击单选按钮时,共享相同 formControlName 的其余组件应更新为活动值。
我该怎么做?
javascript typescript angular angular-reactive-forms controlvalueaccessor
您好,我尝试做一个Web应用程序,但是我遇到了问题。当我从/ oauth / token请求令牌时,收到以下响应:
{"error":"unsupported_grant_type","message":"The authorization grant type is not supported by the authorization server.","hint":"Check the `grant_type` parameter"}
Run Code Online (Sandbox Code Playgroud)
我的代码是:
import { Injectable } from '@angular/core';
import { Http, Response, RequestOptions, Headers } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/Rx';
@Injectable()
export class UserService {
private API: string = 'api/';
private OAuth: string = 'oauth/'
constructor(private _HTTP: Http) { }
private get_header(): RequestOptions {
let headers = new Headers();
headers.append('Access-Control-Allow-Origin', '*' );
headers.append('Content-Type', 'application/x-www-form-urlencoded' );
return new RequestOptions({ …Run Code Online (Sandbox Code Playgroud) 完整错误:
Exception has occurred.
Illuminate\Contracts\Filesystem\FileNotFoundException: File does not exist at path D:\Projects\shop\back-end\storage\framework/cache/data/9c/1c/9c1c01dc3ac1445a500251fc34a15d3e75a849df
Run Code Online (Sandbox Code Playgroud)
我试过 php artisan cache:clear, php artisan config:cache。没有结果..
我正在尝试在控制器内部执行路由/api/user/signin ,以将 Guzzle HTTP post 发送到/oauth/token。很棒,但是服务器停顿了。我发现了这个:/sf/answers/3244527821/
那我该怎么办呢?如何在没有 HTTP 请求的情况下调用 /oauth/token?我可以“创建”一个请求类并传递给该函数吗?
我开始学习Angular2,但是..我试着在我的组件中创建一个服务并导入,但是我收到了这个错误:
错误TS2339:属性'commentService'在类型'CommentsComponent'上不存在.
comment.service.ts
import { Injectable } from '@angular/core';
@Injectable()
export class CommentService {
testfunction() {
return 'valoare';
}
}
Run Code Online (Sandbox Code Playgroud)
comments.component.ts
import { Component, OnInit } from '@angular/core';
import { CommentService } from '../services/comment.service';
@Component({
template: 'dadada',
providers: [CommentService]
})
export class CommentsComponent implements OnInit {
construct(commentService: CommentService) {
}
ngOnInit() {
console.log( this.commentService.testfunction() );
}
}
Run Code Online (Sandbox Code Playgroud)
app.component.ts
import { Component } from '@angular/core';
import { ROUTER_DIRECTIVES } from '@angular/router';
@Component({
selector: '[web-application]',
templateUrl: 'template/home',
directives: [ROUTER_DIRECTIVES]
})
export class …Run Code Online (Sandbox Code Playgroud) 我如何在*ngIf中使用抽象函数?
export abstract class Item
{
constructor(name: string, url: string, image: string)
{
this.name = name;
this.url = url;
this.image = image;
}
private name?: string;
private url?: string;
private image?: string;
public abstract isText(): boolean;
public abstract isLink(): boolean;
public abstract isImage(): boolean;
public get Name(): string
{
return this.name;
}
public get Url(): string
{
return this.url;
}
public get Image(): string
{
return this.image;
}
}
export class Image extends Item
{
constructor(url:string, image: string)
{
super(undefined, …Run Code Online (Sandbox Code Playgroud)