On 07/30/2014 07:51 AM, Dennis Matveyev wrote:
I am new to JS and Angular.  I write code in PHP.

I want to take my PHP variable, which is an array of objects
containing data, from a PHP script, "pass it to JavaScript", and use
navigational buttons for right/left inside the HTML to step through
the array of data, while formatting the data nicely on screen inside
a table.  What user sees first is a table with data at array index of
0.  User presses "right", and now sees table with data at index 1,
and so on.

How do I do so, or where can I find a _good_ Angular example of doing
so?

-- 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]
<mailto:[email protected]>. To post to this group,
send email to [email protected]
<mailto:[email protected]>. Visit this group at
http://groups.google.com/group/angular. For more options, visit
https://groups.google.com/d/optout.


You can pass your complex data to angular using json.


<?php

$my_json = json_encode($my_complex_variable);

?>


<script>

var my_complex_variable = angular.fromJson('<?php print $my_json ?>');

</script>


The rest is easy if you read some angular tutorials.  Basically,
you want to bind a span to a variable that you would make point at
different parts of your data structure in response to the button
clicks.

Tobiah

--
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/d/optout.

Reply via email to