Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Selector issues while integrating MSAL [Angular 15]


In the app.component.ts, the '@Component' decorator uses the selector "body[root].

I have followed the Microsoft Documentation to include MSAL in our project (default auth has been removed from the project while following the skeleton guide)

For MSAL to work, the app component needs the selector to refer to a html tag 'app-root' with the HTML as <app-root></app-root> and for another tag <app-redirect> to be added.

When the app.component.ts uses selector body[root] - the pages load normal however in the console the MSAL errors with:
'ERROR Error: The selector "app-redirect" did not match any elements'

If I change the app.component.ts selector to 'app-root' the console shows MSAL Auth working properly however the application will never load past the splash screen I imagine because Metronic is dependent on the 'root' tag being used through the body element.

Is there a way to change metronic to work properly with the 'app-root' method? I am relatively new to Angular so perhaps there is a better solution.

Any help is appreciated!


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


*To clarify, I do have the app-redirect tag in my index.html but it is not found when body[root] is being used.



I have the same issue!



Hi Devon,

I apologize for the delay in getting back to you. Regarding your previous question, it seems that the body[root] is required for the style and removing it could potentially break the CSS. We will need to investigate this further to provide you with a more accurate solution.

Thank you for your patience.

Best regards.



Hi Faizal, any news on this as this is a large issue for our system?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(