Use link cakephp with angular - angularjs

Could be possible to use {{ somethingAngular }} inside a link cakephp, or Need I to convert my aplication to angular using html link or img tags?
For example, I cant do this:
<?php echo $this->Time->format('d', '{{ video.Video.created }}'); ?>
Error
Regards!

Related

API contents display using angularjs

hello friends i developed an API for FAQ page like below
I want to display selection:label and selection:key following is my angular code but i am unable to get output
tell me friends how to call inner API contents using angularjs? any syntax modification in angular code ??
Put this inside your div ng-repeat
<div>{{ a.items['selection:key'] }}</div>
<div>{{ a.items['selection:label'] }}</div>

AngularJs - Pass angular argument to file twig

How can I pass an Angular item to twig file included?
This is my twig file that I want to include:
<a href="javascript:void(0)" title="[{ hostess.gender == 'F' ? 'Hostess top' : 'Steward top' }]">
<img src="{{ WBASE }}/assets/img/badge/top-profile.png" class="c-badge [{ extraClass }]"/>
</a>
Instead this is my twig file where I render data through angular loop. I need to include a twig file if the condition is true:
{% if hostess.top %}
{% include '_commons/elements/ng-badge-top.twig' with {'hostess': hostess} %}
{% endif %}
But it doesn't work. How can I do it?
I think that you won't be able to do it like that.
Take in consideration that angular is front-side rendered and twig server-side.
If you want to achive that, you will probably have to craete your ng-badge-top.twig as a html and include it with angular using "ng-include".
You can also try something like this:
<div ng-if="[{ hostess.top }]"
ng-include="'{{ path('view_route', { view: 'Content/test.html.twig' }) }}'"></div>
This last piece of code will do a call to the server to get a html file and render it. Take in consideration that this controller should serve HTML files, otherwise angular won't be able to process them. Didn't tested it, but if it doesn't work tell me and we will figure out what's wrong.
If those solutions doesn't fit your needs I can give you other options :)

dropdown checkbox list cakephp

Can we do something like image below on cakephp. If can, how to do it? I am struggle with it. I try to find any answers but can not found something like this. Any answers for this problem will be great appreciated.
This can also be done with Bootstrap as well. The functionality is generally the same as #Anubhav 's answer from a bit earlier, however this is a little cleaner and a more up to date solution. The Bootstrap Framework is maintained/updated a lot more frequently.
See here for full solution:
Bootstrap dropdown checkbox select
No you cant do this using only CakePHP... but the above thing can be done using jQuery.
Please follow the link and your task will be done easily
http://dropdown-check-list.googlecode.com/svn/trunk/doc/dropdownchecklist.html
Cheers
multiple dropdown options with checkbox in cakephp error
<div class="col-md-2 place-grid">
<h5>Property Type</h5>
<?php $allCategories=$this->Common->getCategories(); ?>
<?php echo $this->Form->input('ptype',array('options' =>$allCategories,'style'=>'width:150px;','error'=>false,'id'=>'ptype','onchange'=>'getIdType()','div'=>false,'label'=>false,'empty'=>'Select Type','class'=>"sel")); ?>
<?php if($this->Form->error('ptype')){?>
<?php echo $this->Form->error('ptype',array('style'=>'txtError'));?>
<?php } ?>
</div>
<div class="col-md-2 place-grid">
<h5>Sub Type</h5>
<?php $allSubCategories=$this->Common->getArticleSubCategories(); ?>
<?php echo $this->Form->input('sptype',array('options'=>'', 'style'=>'width:150px;','error'=>false,'div'=>false,'select'=>true,'label'=>false,'empty'=>'fgfg','class'=>"sel")); ?>
</div>

AngularJS and ns-select without ng-option

in my page I load the content of a div via "ng-include src". In this content I have a <select> item:
<select name="relationship" ng-model="userEdit.relationship">
<?php
$tree = taxonomy_get_tree(5);
foreach ($tree as $row) {
echo "<option value=".$row->tid.">".$row->name."</option>\n";
}
?>
</select>
In my "controller" function I can not to create this tree into an array to pass to "ng-options" because I have no access to source tree via web. I can only read the full HTML form. I can change the source of the form (if I need to inject something for example) but I can not get the original tree in my controller.
However, the HTML is ok, but when I choose my "relationship" and send the form (ng-click="myfunction()") to my controller function i can see that there is no "relationship" in "userEdit" object.
Where is my error ?
Thanks.
You are missing quotes
echo "<option value='".$row->tid."'>".$row->name."</option>\n";

Performance issue :Angular JS showing script in html page

When I call a rest service then i will get .html file from server. But it showing scripts for 1 or 2 seconds. Then it shows correct values.My problem is page loads first then controller binds data. Is there is any way to bind data before loading page?
There are basically two options that I know of:
The preferred option is to add ng-cloak to sections of the page that contain angular templates. From the docs:
<div id="template1" ng-cloak>{{ 'hello' }}</div>
<div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div>
Use ng-bind instead of the {{ }} approach. For example:
<div ng-bind="marked4Reviewcount"></div>
Have a look at the ngCloak directive. It temporarily hides the Angular template while the page is being loaded. You could apply it on the body tag, but it's advised to do it on portions of the page so you get a progressive loading effect.
http://docs.angularjs.org/api/ng.directive:ngCloak

Resources