Open Anthony-Breneliere opened 2 years ago
Hi @Anthony-Breneliere,
Thanks for raising this concern. @Rick-Kirkham, could you please investigate?
@Anthony-Breneliere If the Angular option is in Yo Office, then the documentation has to mention it. So, this is really a request to remove the Angular option from Yo Office. Accordingly, I will transfer this issue to the repo for Yo Office.
Now, a question: Would all Office Add-ins built on Angular require injectable services? If not, then it would probably be best to keep the Angular option in Yo Office and document the limitations of the add-in that gets created, until a better project template for the Angular option is created.
Now, a question: Would all Office Add-ins built on Angular require injectable services? If not, then it would probably be best to keep the Angular option in Yo Office and document the limitations of the add-in that gets created, until a better project template for the Angular option is created.
Yes. Without injection you cannot do anything in Angular other than "Hello world" or something like this. Angular's framework is divided into modules, and to use module's services you have to inject them into your own services or components.
Beyond that, the documentation references an office add-in template, so that template should provide a good starting point to write an office addin. Otherwise thousands of people will lose days starting an application that has to be written entirely, or scratching their head about why DI does not work, like me. So if the response was No, I encourage to wait for the sample to be corrected before adding it to the Yo Office.
Another issue is each component's html has to be referenced in the webpack.config to be http served in the dev environment, in a classic Angular app it is transparent and automatically managed by Angular CLI.
The Office add-in template has to be made from Angular 's basic app with ng new. Just that, and there is no issue.
I would like to chime in. Calling the sample created by yo as "Angular" is just wrong. This sample does use the Angular libraries but is so far from any Angular standard it should just be dropped. Not injecting is just one of the issues. The complete webpack config is a mess. For more details read here (not written by me, but highly agree): https://javascript.plainenglish.io/developing-office-plugins-using-angular-and-nx-5aaf4461e967
We are aware the current angular template is not up to standards. Currently, we have an open PR to make it more usable: https://github.com/OfficeDev/Office-Addin-TaskPane-Angular/pull/93
The "yo Office" for Angular generates a bad Angular application where dependency injection does not even work.
https://github.com/OfficeDev/Office-Addin-TaskPane-Angular/issues/45
Furthermore each component's html requires to be added in the webpack.config file, that is not possible when using Angular libraries.
That is why yo Office should not belong to the documentation as long as the Angular samples that it generates have not been reworked.
[Enter feedback here]
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.