Я хочу сослаться на одну .aspx
страницу в приложении angular из приложения ASP через запрос HTTP, здесь приложение angular и приложение ASP имеют два разных локальных хоста. Я должен соединить обе ссылки хоста.
В приведенном ниже коде страница не ссылается. Пожалуйста, предложите решение для моего требования.
Вот мой фрагмент кода
app.component. html
<div class="container">
<button class="btn btn-primary" (click)="viewReport()">View</button>
</div>
app .component.ts
import { Component, OnInit } from '@angular/core';
import { DataService } from '../data.service';
@Component({
selector: 'app-report',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent implements OnInit {
constructor(private ds:DataService) {
}
ngOnInit() {
}
viewReport(){
this.ds.loadASPX().subscribe(data=>
{
debugger;
// logic
}, error=>
{
alert("error");
})
}
dataService.ts
import { Injectable } from '@angular/core';
import { HttpClient } from "@angular/common/http";
@Injectable({
providedIn: 'root'
})
export class DataService {
constructor(private http:HttpClient) {
}
loadASPX(){
return this.http.get("http://localhost:18306/Content/RecoveryReport/report.aspx", { responseType: 'text' });
}
}