是否可以在模板中连接插值字符串?当我想访问特定的URL时(在下面data
标签的object
属性中),我可以将字符串插值与更多文本结合起来。
示例:
<mat-tab-group>
<mat-tab label="{{ thing.FileName }}" *ngFor="let thing of things | async">
<-- WORKS FINE -->
<div id="pdf">
<object width="100%" height="650" type="application/pdf" data="https://someurl.com%2FToward%20A%20Theory%20Of%20Schizophrenia%20-%20Gregory%20Bateson.pdf?alt=media&token=f68187e1-1e1b-4066-8a5d-a6f3f6576f72#zoom=85&scrollbar=0&toolbar=0&navpanes=0" id="pdf_content" style="pointer-events: none;">
<p>Error message here, in case the PDF cannot be displayed.</p>
</object>
</div>
<-- ERROR -->
<div id="pdf">
<object width="100%" height="650" type="application/pdf" data="{{submission.FileURL}}#zoom=85&scrollbar=0&toolbar=0&navpanes=0" id="pdf_content" style="pointer-events: none;">
<p>Error message here, in case the PDF cannot be displayed.</p>
</object>
</div>
</mat-tab>
</mat-tab-group>
打字稿
thingsCollection: AngularFirestoreCollection<Submission>;
things: Observable<Submission[]>;
this.thingsCollection = this.afs.collection(pathSubmissions);
this.things = this.submissionsCollection.valueChanges();