Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while rendering string having spaces #110

Closed
gaurangmangukiya opened this issue Jan 3, 2022 · 3 comments
Closed

Issue while rendering string having spaces #110

gaurangmangukiya opened this issue Jan 3, 2022 · 3 comments

Comments

@gaurangmangukiya
Copy link

gaurangmangukiya commented Jan 3, 2022

Code is like this

<ul class="menu"> <li class={{ navigationType === "home" ? "current-menu-item" : "" }}> <a href="/">Home</a> </li> {{-- <li class="menu-item-has-children current-menu-item"><a href="#">Company</a> --}} <li class={{ navigationType === "company" ? ["menu-item-has-children", "current-menu-item"].join(' ') : "menu-item-has-children" }}><a href="#">Company</a> <ul class="sub-menu"> <li><a href="/about">About us</a></li> <li><a href="/why-choose">Why Choose Us</a></li> <li><a href="/team">Our team</a></li>

And with this

`


  • Home

  • <li class="menu-item-has-children" current-menu-item=""><a href="#">Company</a>
                                        <ul class="sub-menu">
                                            <li><a href="/about">About us</a></li>
     <li><a href="/why-choose">Why Choose Us</a></li>`
    

    Edge JS is rendering like this

    • Home
    •     <li class="menu-item-has-children" current-menu-item=""><a href="#">Company</a>
                <ul class="sub-menu">
            <li><a href="/about">About us</a></li>
      

      I also tried this

      <li class={{ navigationType === "company" ? menu-item-has-children current-menu-item : "menu-item-has-children" }}><a href="#">Company</a>

      Still having issue

    @gaurangmangukiya
    Copy link
    Author

    gaurangmangukiya commented Jan 3, 2022

    As you can see its rendering wrong at this
    <li class="menu-item-has-children" current-menu-item="">

    it should be like
    <li class="menu-item-has-children current-menu-item">

    @RomainLanz
    Copy link
    Member

    RomainLanz commented Jan 3, 2022

    Hey @gaurangmangukiya! 👋🏻

    You are forgetting the " inside your HTML.

    Taking your example:

    <!-- WRONG -->
    <li class={{ navigationType === "home" ? "current-menu-item" : "" }}>
    
    <!-- CORRECT -->
    <li class="{{ navigationType === "home" ? "current-menu-item" : "" }}">

    @gaurangmangukiya
    Copy link
    Author

    @RomainLanz Worked. Thank You...

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants