function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
❤Code❤Code 

angular js + visualforce

Hi ,

I am new to Angular JS. I wrote the below code. Seems its not working. Can anyone tell where the mistake has happened.

<apex:page applyhtmltag="false" showheader="false">
   <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"/> 
  <div ng-app="app">
    <div>
         Name:<input ng-model="name" type="text"/>
         Hello {{name}}
    </div>
  </div>
</apex:page>

Regards
Best Answer chosen by ❤Code
EnreecoEnreeco
You miss the definition of your AnuglarJS application and controllers.
Try this easy tutorial of AngularJS on Visualforce for increasing your skills: http://www.oyecode.com/2013/06/getting-started-with-angularjs-on.html

 

All Answers

EnreecoEnreeco
You miss the definition of your AnuglarJS application and controllers.
Try this easy tutorial of AngularJS on Visualforce for increasing your skills: http://www.oyecode.com/2013/06/getting-started-with-angularjs-on.html

 
This was selected as the best answer
Manu K MManu K M
Hi, 
You missed the app definition like Enreeco said. 
you must dfine the app to work angular js aplication in salesforce.
the definition will look like,
<script>
   angular.module('app',[]);
</script>

here 'app' is the name of you angular js app, it can can be any thing you want to give.
After adding definition to your code, your code will look like.
<apex:page applyhtmltag="false" showheader="false">
  <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"/> 
   <script>
   angular.module('app',[]);
   </script>
  <div ng-app="app">
    <div>
         Name:<input ng-model="name" type="text"/>
         Hello {{name}}
    </div>
  </div>
</apex:page>

Its working,
regards 
Manu K M