我想在我的 Angular 5 应用程序上使用谷歌地图,但我遇到了一些问题。
加载视图时,我在 js 控制台中收到错误:
LoginComponent_Host.ngfactory.js? [sm]:1 ERROR ReferenceError: google is not defined
at LoginComponent.ngAfterViewInit (login.component.ts:15)
at callProviderLifecycles (core.js:12428)..
Run Code Online (Sandbox Code Playgroud)
我的组件:
import {AfterViewInit, Component} from '@angular/core';
declare let google: any;
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements AfterViewInit {
ngAfterViewInit(): void {
let origin = new google.maps.LatLng(4.0, 2.0 );
let destination = new google.maps.LatLng(1.0, 1.5);
}
constructor() {}
}
Run Code Online (Sandbox Code Playgroud)
app.module.ts
import {AgmCoreModule} from '@agm/core';
@NgModule({
declarations: [
AppComponent,
LoginComponent
],
imports: [
BrowserModule,
FormsModule, …Run Code Online (Sandbox Code Playgroud) I'm implementing OAuth2 authorization using Spring Boot. I have already Authorization Server and Resource Server, now I want to access resources from Resource Server using client_credentials grant type.
I'm little confused about it, because in Resource Server I have to add client_id and client_secret. But why Resource Server really need it?
As I understand this concept client should get from Authorization Server using client credentials his access token. And then send this access token to Resource Server without any …