I am trying to display an internal single page application (SPA) within a Word VSTO Add-In using the windows forms webbrowser control. For the front-end of the application I am using Angular.
However when I insert a <select>
element with the (change)
event bound, it causes the SPA to crash. This only occurs within the Word VSTO Add-In. If I run the SPA within a webbrowser control on a regular windows forms application everything runs fine.
I have included screenshots of a simple example SPA running in the webbrowser controls below. For both applications i have included a second webbrowser control displaying the browser version using http://whatismybrowser.com. Both applications are running on the same machine:
- Windows 10
- Word Office 2013
- Visual Studio 2017
Image of the SPA running on a regular Windows Forms Application
Image of the SPA running in the Word VSTO Add-In, the <select>
elements are not rendered.
I have set the necessary registery keys as described here.
I have included the X-UA-Compatible meta tag as described here.
Angular component code.
import { Component } from '@angular/core'
@Component({
selector: 'test-word',
templateUrl: './test-word.component.html',
styleUrls: [
'./test-word.component.css',
'../app/app.component.css',
]
})
export class TestWordComponent {
public options: any[] = ["Option 1", "Option 2", "Option 3"];
onChange(event: any) {
alert (event.target.value);
}
constructor() {
}
}
Angular Component HTML template
<div>
Select Element without bound change event.
<select class="form-control">
<option *ngFor="let option of options">{{option}}</option>
</select>
<br />
Select Element with bound change event.
<select class="form-control" (change)="onChange($event)">
<option *ngFor="let option of options">{{option}}</option>
</select>
</div>
I also did the same for a simple React component. The same thing happens when I incorporate a <select>
element. Everything runs fine in a desktop browser and no errors are logged in the console. Binding to events on other elements (input) do not cause the SPA to crash within Word VSTO.
Any kind of help will be greatly appreciated!