Office-js-docs-pr: messageBanner Issues (cont'd)

Created on 29 Oct 2019  路  3Comments  路  Source: OfficeDev/office-js-docs-pr

_Note: This is a continuation of the "messageBanner Issues" issue (I don't think I have access to re-open it)._

I was running into an issue where an exception was being thrown on the "messageBanner" variable within Home.ts. The recommendation was to include these lines after $(document).ready(function () {, as shown here:

$(document).ready(function () { // Initialize the notification mechanism and hide it var element = document.querySelector('.MessageBanner'); messageBanner = new components.MessageBanner(element); messageBanner.hideBanner();

I'm not yet sure if this resolves the messageBanner issue however, because a new compiler issue emerges where the file can't find "components".
image

Do we need to declare components at the top of the file?

Article URL

https://docs.microsoft.com/en-us/office/dev/add-ins/develop/convert-javascript-to-typescript

add-ins fixed doc bug

All 3 comments

Please ensure you've completed all of the steps in the (just updated a little while ago) article: https://docs.microsoft.com/en-us/office/dev/add-ins/develop/convert-javascript-to-typescript.

I'm guessing you probably haven't renamed the ./Scripts/MessageBanner.js file to MessageBanner.ts yet (doing so should resolve the "cannot find name components" error), and there's likely another step or two in the article that you'll need to complete as well (e.g., editing the line _onResize(null); in ./Scripts/MessageBanner.ts to be _onResize(); instead).

Now that it's been updated, the article should contain complete/correct guidance to get everything working properly. Please let me know if that's not the case. Thanks!

Yes, following the updated article worked great. Thank you so much for all your help!! :D

Awesome, thanks for confirming!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chucklay picture chucklay  路  7Comments

PramodKumarYadav picture PramodKumarYadav  路  3Comments

fowl2 picture fowl2  路  5Comments

fitojb picture fitojb  路  3Comments

peteshub picture peteshub  路  7Comments