Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS variable value in location.href in onclick is not resolving

In HTML i have a angular variable called

boards.current.url

whose value i can see via

{{boards.current.url}}

However i want to use it's value in location.href as below,

<div class="board" onclick="location.href='{{boards.current.url}}'" style="cursor: pointer;">

this is not working - the value of angular variable

boards.current.url

doesn't get resolved - any insights?

like image 364
Jimmy MO Avatar asked Aug 02 '26 02:08

Jimmy MO


1 Answers

use angular-directive ng-click instead of onclick

<div class="board" ng-click="location.href='{{boards.current.url}}'" style="cursor: pointer;">
like image 112
Sajeetharan Avatar answered Aug 04 '26 15:08

Sajeetharan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!