Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check ng-if value with one php value

How can I check ng-if value with one php value.Is this possible..? Give me some solution....

<div ng-if="val.PRDCODE=='<?=$value?>'">
</div>
like image 255
Pravin Avatar asked Mar 16 '23 17:03

Pravin


1 Answers

Its not a good way of doing that. If you want to do, then simply fire an AJAX call and set your value in controller scope's object. But if you want to do it in this way then you can achieve it by using ng-init directive, like I've done in one of my projects. Just use

<div data-ng-app="MyApp" data-ng-controller="DemoController" data-ng-init="value='<?php echo $value?>'">

and in your condition, use like

<div data-ng-if="val.PRDCODE == value">

Hope it may help you.

like image 108
Vineet Avatar answered Mar 24 '23 05:03

Vineet