简体   繁体   中英

Passing a variable from angular to JS

I am sure this is fairly simple, but I am stuck.

I am creating a list of my projects for my portfolio and one thing I want is to open a modal when you click on one of the projects. I know there are probably good ways to do modals that I am overlooking, but I already have this set up.

What I currently have is:

<div class="info" onclick="loadModal('{{project.name}}');">

But when I render it in chrome, I get:

<div class="info" onclick="loadModal('{{project.name}}');" style="height: 317px;">
    ...
</div>

instead of the variable being passed.

Is there an easy way to fix this or will I have to do it a completely different way?

Thank you

将函数拉入作用域并改为执行此操作

<div class="info" data-ng-click="loadModal(project.name)">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM