Thanks, how do I put the post in "solved" state. Or do moderators do that?
On Tuesday, March 4, 2014 4:23:45 PM UTC-5, Billy Figueroa wrote: > > Hi Antoine I think that clears things up for me. So my "shell" page is ok > because that can be interpreted by the server, while the "template" is > being interpreted by angular which is javascript client side code. So if I > have this right...we can NEVER use php code inside of an angular js > template that is being rendered with ng-view, or for that matter anything > that is NOT html (i.e. python, ruby)? > > I am familiar with services and factories. I have actually been using > directives a lot in this website and have used $http.post plenty of times > which on success I feed into my model and then use angular to display the > data. However in this case I did not want to create a separate PHP script > to do this, I wanted to do it like I was doing the old way (before using > angular) which was to have php code executed from the index.php page to > call a function (which I had access to by having the include statement at > the top in php). The issue here is I had php code inside of an angular js > loaded template, which even though I named "main.php", angular does not > know how to render the php > > I think the confusion was I was expecting angular to be able to display > php and it cannot. Not only with php it probably can not output python or > anything that is not html. Amiright? > > On Tuesday, March 4, 2014 3:28:32 PM UTC-5, Antoine Polatouche wrote: >> >> Le 04/03/2014 20:28, Billy Figueroa a écrit : >> > >> > Hello, I have an issue when trying to call a function from a php >> > template file that is being loaded via ng-view. This is only a problem >> > inside the ng-view directive. If I make a function call from the >> > main/shell page then it executes properly but if I make the same call >> > from a template file being loaded with ng-view it does not work. >> > >> This is not related to AngularJS. >> You have to understand how php and javascript are working: php scripts >> are interpreted on the server side, when a php file is requested. >> Javascript is interpreted on the client side. >> So the template loaded by AngularJS can't be interpreted on the client >> side. >> >> Your FiddelJS can't work, because a php script doesn't work in a html >> file, neither in a css file... >> >> This is not an issue nor a limitation. >> >> If you need to use php scripts, take a look at >> http://docs.angularjs.org/api/ng/service/$http. You can implement an >> AngularJS service that is requesting php scripts and use this service in >> your javascript code. >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
