I have the below HTML tag where the value of "style" for nav tag should be loaded using ternary operator. I don't have any error but the desired result is not achieved
<nav class="navbar navbar-expand-md navbar-light navbar-laravel"
style="{{ Request::path() }} == 'home' ? 'background-color: darkgrey' : '' ">
Can anyone help me where I am going wrong
Try code below:
<nav class="navbar navbar-expand-md navbar-light navbar-laravel"
style="{{ Request::path() == 'home' ? 'background-color: darkgrey' : '' }}">
Replace your code with following.
{{ (Request::path() == 'home') ? 'background-color: darkgrey' : ''}}
simple solution:
style="{{ Request::path() == 'home' ? 'background-color: darkgrey' : '' }}"