You need to sign in to do that
Don't have an account?

i would like to display the list of records in page using angular js
Hi Guys,
I have written the simple code mentioned below. I don't know why it is displaying the records. Please help me on this.
<apex:page controller="AngularJS_Page2" docType="html-5.0" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="true" cache="false">
<head>
<meta charset="utf-8"/>
<!-- <apex:includeScript value="{!URLFOR($Resource.AngularJS, '/lib/angular.js')}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js" />-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.min.js"/>
</head>
<div ng-app="myapp" ng-controller="mycontroller">
<table>
<tr>
<th>Name</th>
<th>Phone</th>
</tr>
<tr ng-repeat="Acc in Accounts">
<td ng-bind="Acc.name"></td>
<td ng-bind="Acc.phone"></td>
</tr>
</table>
</div>
<script>
var app=angular.module('myapp',[]);
app.controller('mycontroller',funtion($scope){
$scope.Accounts = {!Accountslist};
});
</script>
</apex:page>
Apex Class:
public with sharing class AngularJS_Page2 {
public String getAccountslist() {
return JSON.serialize([select id,name,phone from account]);
}
}
Thanks in Advance.
I have written the simple code mentioned below. I don't know why it is displaying the records. Please help me on this.
<apex:page controller="AngularJS_Page2" docType="html-5.0" standardStylesheets="false" applyBodyTag="false" applyHtmlTag="true" cache="false">
<head>
<meta charset="utf-8"/>
<!-- <apex:includeScript value="{!URLFOR($Resource.AngularJS, '/lib/angular.js')}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js" />-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.min.js"/>
</head>
<div ng-app="myapp" ng-controller="mycontroller">
<table>
<tr>
<th>Name</th>
<th>Phone</th>
</tr>
<tr ng-repeat="Acc in Accounts">
<td ng-bind="Acc.name"></td>
<td ng-bind="Acc.phone"></td>
</tr>
</table>
</div>
<script>
var app=angular.module('myapp',[]);
app.controller('mycontroller',funtion($scope){
$scope.Accounts = {!Accountslist};
});
</script>
</apex:page>
Apex Class:
public with sharing class AngularJS_Page2 {
public String getAccountslist() {
return JSON.serialize([select id,name,phone from account]);
}
}
Thanks in Advance.