我正在尝试将AGM集成到我的Bootstrap 5应用程序中,但地图没有出现,我在浏览器中看到错误。
我认为这与我操纵网址的事实有关,特别是static bool ContainsIgnoreCase(this string @this, string other)
=> @this.IndexOf(other, StringComparison.OrdinalIgnoreCase) >= 0;
。
Angular& AGM版本 Angular版本v5.2.9& agm / core v1.0.0-beta.2
你对如何解决这个问题有任何想法吗?
deviceId
deviceLocation.component.ts
错误:
@Component({
selector: 'deviceLocation',
templateUrl: 'deviceLocation.template.html'
})
export class DeviceLocationComponent implements OnDestroy, OnInit {
title = 'My first AGM project';
lat = 51.678418;
lng = 7.809007;
public constructor(private http: Http, private router: Router, private route: ActivatedRoute) {
this.nav = document.querySelector('nav.navbar');
this.token = localStorage.getItem('token');
localStorage.setItem('currentRoute', 'deviceLocation');
}
public ngOnInit(): any {
this.nav.className += ' white-bg';
this.sub = this.route.params.subscribe(params => {
this.deviceId = params['id']; // Parameter Name
});
const myHeader = new Headers();
myHeader.append('Content-Type', 'application/json');
myHeader.append('Authorization', 'Bearer ' + this.token);
this.http.get(GlobalsSettings.API_ENDPOINT + 'devices/' + this.deviceId + '/locations', { headers: myHeader })
.subscribe(
response => {
console.log(response.json());
this.data = response.json();
},
error => {
// alert(error.text());
this.device_locations_error_pres = true;
this.device_locations_err = error.json();
}
);
}
}
和
ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'undefined: /device//deviceInformation'. Current value: 'undefined: /device/5aba4ffa8500f4000515ee07/deviceInformation'.
Stack trace:
viewDebugError@webpack-internal:///./node_modules/@angular/core/esm5/core.js:9991:32
expressionChangedAfterItHasBeenCheckedError@webpack-internal:///./node_modules/@angular/core/esm5/core.js:9969:12
checkBindingNoChanges@webpack-internal:///./node_modules/@angular/core/esm5/core.js:10136:15
checkNoChangesNodeInline@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14184:9
checkNoChangesNode@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14158:9
debugCheckNoChangesNode@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14987:24
debugCheckDirectivesFn@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14889:13
View_NavigationComponent_3/<@ng:///LayoutsModule/NavigationComponent.ngfactory.js:209:21
debugUpdateDirectives@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14871:12
checkNoChangesView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:13996:5
callViewAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14349:21
execEmbeddedViewsAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14327:17
checkNoChangesView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:13997:5
callViewAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14349:21
execComponentViewsAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14301:13
checkNoChangesView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:13999:5
callViewAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14349:21
execComponentViewsAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14301:13
checkNoChangesView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:13999:5
callViewAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14349:21
execEmbeddedViewsAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14327:17
checkNoChangesView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:13997:5
callViewAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14349:21
execComponentViewsAction@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14301:13
checkNoChangesView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:13999:5
callWithDebugContext@webpack-internal:///./node_modules/@angular/core/esm5/core.js:15272:39
debugCheckNoChangesView@webpack-internal:///./node_modules/@angular/core/esm5/core.js:14816:12
ViewRef_.prototype.checkNoChanges@webpack-internal:///./node_modules/@angular/core/esm5/core.js:11807:19
ApplicationRef.prototype.tick/<@webpack-internal:///./node_modules/@angular/core/esm5/core.js:6125:62
ApplicationRef.prototype.tick@webpack-internal:///./node_modules/@angular/core/esm5/core.js:6125:17
next/<@webpack-internal:///./node_modules/@angular/core/esm5/core.js:5956:99
ZoneDelegate.prototype.invoke@webpack-internal:///./node_modules/zone.js/dist/zone.js:388:17
onInvoke@webpack-internal:///./node_modules/@angular/core/esm5/core.js:4965:24
ZoneDelegate.prototype.invoke@webpack-internal:///./node_modules/zone.js/dist/zone.js:387:17
Zone.prototype.run@webpack-internal:///./node_modules/zone.js/dist/zone.js:138:24
NgZone.prototype.run@webpack-internal:///./node_modules/@angular/core/esm5/core.js:4782:54
next@webpack-internal:///./node_modules/@angular/core/esm5/core.js:5956:69
EventEmitter.prototype.subscribe/schedulerFn<@webpack-internal:///./node_modules/@angular/core/esm5/core.js:4547:36
SafeSubscriber.prototype.__tryOrUnsub@webpack-internal:///./node_modules/rxjs/_esm5/Subscriber.js:245:13
SafeSubscriber.prototype.next@webpack-internal:///./node_modules/rxjs/_esm5/Subscriber.js:192:17
Subscriber.prototype._next@webpack-internal:///./node_modules/rxjs/_esm5/Subscriber.js:133:9
Subscriber.prototype.next@webpack-internal:///./node_modules/rxjs/_esm5/Subscriber.js:97:13
Subject.prototype.next@webpack-internal:///./node_modules/rxjs/_esm5/Subject.js:65:17
EventEmitter.prototype.emit@webpack-internal:///./node_modules/@angular/core/esm5/core.js:4527:24
checkStable@webpack-internal:///./node_modules/@angular/core/esm5/core.js:4930:13
onHasTask@webpack-internal:///./node_modules/@angular/core/esm5/core.js:4978:21
ZoneDelegate.prototype.hasTask@webpack-internal:///./node_modules/zone.js/dist/zone.js:441:21
ZoneDelegate.prototype._updateTaskCount@webpack-internal:///./node_modules/zone.js/dist/zone.js:461:17
Zone.prototype._updateTaskCount@webpack-internal:///./node_modules/zone.js/dist/zone.js:285:17
Zone.prototype.runTask@webpack-internal:///./node_modules/zone.js/dist/zone.js:205:25
drainMicroTaskQueue@webpack-internal:///./node_modules/zone.js/dist/zone.js:595:25
NavigationComponent.html:34:71