Ok this still makes no sense.
Real world example. posts_controller function index() url site/posts standard get all items paginated first 15.
In the view I have a foreach loop for each $posts as $post{
echo $this->Element->('Posts/view_block'); // view block is just a block of repeated code for each $post
}
If logged in as a member and on member_index same block is used to show records to user/member
Add a new post via ajax I simply return the view_block in the json response so its standard 1 bit of code used in many place.
So if on member_index, I have the form at the top of the page with a few fields. Submit and on save the view_block element html is included in the json response and animated / slide down added to the list of records. So that view_block is currently used in 3 places.
Front end index, member_index, member_add.
If a user assess a page with js disabled and all the code is in angular/partials then what? Your saying have an element and a copy in html in partials. Same exact code in 2 places?
Sorry makes no sense.
Any clarification would be great.
Thanks,
Dave
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of MihaiTL
Sent: Monday, February 10, 2014 4:26 PM
To: cake-php@googlegroups.com
Subject: Re: Cake and Angular Question
I think that instead of
partials/phone-list.html
you should use
phone_list_controller / action_for_phone_list
and you should create phone_list.ctp view
Something similar should be done for
partials/phone-detail.html
luni, 10 februarie 2014, 20:25:17 UTC+2, advantage+ a scris:
Looking deeper into updating a site to use Angular.js but first thing I noticed was looking at the demo here http://docs.angularjs.org/tutorial that in the app.js it references using html partials (element in Cake terms):
phonecatApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl'
}).
when('/phones/:phoneId', {
templateUrl: 'partials/phone-detail.html',
controller: 'PhoneDetailCtrl'
}).
otherwise({
redirectTo: '/phones'
});
}]);
Is there a way to use Cakes elements instead?
Seems like having an element to show each record then when added / modified the exact same code in html format rather than .ctp is just wrong.
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment