Develop Office Add-in with Ember


#1

It is possible to develop Office Addin with Ember, accord to https://dev.office.com/docs/add-ins/word/word-add-ins-programming-overview?product=word.

So far, there is not a working sample developed with Ember. I tried it myself, and stuck at the stage - boot the ember application inside Office.initialize.

In Angular sample, https://dev.office.com/docs/add-ins/develop/add-ins-with-angular2,

There is some piece of code,

import { platformBrowserDynamic } from ‘@angular/platform-browser-dynamic’; import { AppModule } from ‘./app.module’;

Office.initialize = function () { const platform = platformBrowserDynamic(); platform.bootstrapModule(AppModule); };

I wonder how it can be done in Ember?

Many thanks,


#2

Same question here. I run into a different issue though. I just added the path to office.js in the index.html. When loading it there is some mess up within jQuery going on giving me this message: TypeError: (0 , _emberMetal.get)(…).replaceState is not a function

Advice anyone?


#3

The first thing I would suggest is switching your Ember app’s location type to hash or none. You do that in config/environment.js, and the docs about the different types are here.

As for controlling the app boot, you can do a couple different things. One simple thing to try is to dynamically build and append a script tag for your app.js, doing that work inside Office.initialize.

Another way would involve setting autoboot to false on your Ember app and booting it manually from Office.initialize.


#4

Thanks for the reply. I noticed that the error I got was caused by the Outlook Add-in scripts nulling the browser history functions. So when Ember tries to manipulate the history, it can’t access the functions anymore. I’m going to try your advice setting the location type to none.


#5

When using location: 'none' nothing in Ember’s router stack should be touching the browser’s history functions.