I know that Angular is rendered client side, and PHP is a server side script but is there any way I can combine the two - it's all very new for me.
For example, this angular response works just fine.
<li ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit" data-name="{{data.customerName}}" class="myli">
<strong>{{data.customerName}}</strong><br />
{{data.addressLine1}}, {{data.city}}, {{data.state}}, {{data.postalCode}}, {{data.country}}<br />
<code>{{data.creditLimit}}</code>
</li>
But what if I wanted to add some PHP logic into it, is there a way I can go about doing this? I appreciate there are javascript equivalents I can use for many features (case:select etc). but not for md5 for example. One of my aims is to load a gravatar image in the resulting li.
<li ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit" data-name="{{data.customerName}}" class="myli">
<strong>{{data.customerName}}</strong><br />
{{data.addressLine1}}, {{data.city}}, {{data.state}}, {{data.postalCode}}, {{data.country}}<br />
<code>{{data.creditLimit}}</code>
<?php if("{{data.creditLimit}}" >= 1000){ // Do Something } ?>
</li>
I would take a shot at ng-if
directive. It is different than show / hide because it actually removes or recreates the dom element.
<div ng-if="data.creditLimit >= 1000"><?php ... ?></div>
Give that a shot and let me know how it works out.
For your example of
but not for md5 for example
You have 3 choices that I see,
calculate the md5 serverside, and pass it into a variable or attribute
var hash = '<?php echo md5( $something ); ?>';
Use ajax to send it to the sever, calculate it and send it back to the client.
Or find a JavaScript solution ( which exists ) such as