Joseph Gremaud
Joseph Gremaud

Reputation: 81

Other way to get DOM element

I have this line to get a dom element. Actually it's in a angularjs component. I need to have the possibily to change following line.

$('[data-remodal-id=modal]').remodal(options);

to something like this :

var id = $ctrl.project.id;
$('[data-remodal-id=id]').remodal(options);

Problem is that i can't convert a string id to what i want or I'm not aware of this at moment. Hope you guys can help me.

As you guys can see this is uncommon jquery selector. I just tried this and it doesn't work.

$('[data-remodal-id="' + id + '"]') 

PS : using following jquery library : http://vodkabears.github.io/remodal/

Upvotes: 0

Views: 68

Answers (2)

Joseph Gremaud
Joseph Gremaud

Reputation: 81

Just don't mix AngularJS and Jquery in components and directive it's a lot of trouble for nothing.

Finally i made my own modal box in angularJS.

Upvotes: 0

tymeJV
tymeJV

Reputation: 104775

You need string concatenation:

$('[data-remodal-id="' + id + '"]')

Upvotes: 2

Related Questions