Skip to main content
Topic: Add Angular to PHP Template (Read 2810 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Add Angular to PHP Template

I want to add this piece of AngularJS code into home page. Can someone tell me how

Code: [Select]
<input type="color" ng-model="vm.bgcolor">
    <div  ng-style="{'background-color':vm.bgcolor}">
      Sample area <br>
      {{vm.bgcolor | json:true}} <br>
    </div>


Re: Add Angular to PHP Template

Reply #1

I am not so sure about that code but unless  AngularJS is included in ElkArte, you should call it first before putting that code in.

Re: Add Angular to PHP Template

Reply #2

I did add Angular to index.template.php . Consider it as adding HTML to a template. Nothing different.


Re: Add Angular to PHP Template

Reply #4

@emanuele , thanks. A little prompting too would be great.

Re: Add Angular to PHP Template

Reply #5

https://www.codeschool.com/courses/shaping-up-with-angular-js <= anything I know about Angular comes from this course.

The addons should be quite self-explanatory: the template is in template files, the js is in js files, the whole adding is done via hooks and using template layer, for example:
https://github.com/emanuele45/MessageHistory/blob/master/MessageHistory.integrate.php#L23

Your question is rather generic: "where do I put some code?"
The only answer I can give you is: BoardIndex.template.php is the template of the home page.
If you can narrow down your question and make it a little more specific, it could be easier to pinpoint the answer you are seeking. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: Add Angular to PHP Template

Reply #6

The above code adds a colour picker which affects the background. I would like to add it available to end users to change the theme's colour scheme.