Hi Guys,
I am from Salesforce technology. I would like to learn AngularJS for UI. I
am facing some issue please help me out from this. I have to display the
values coming from backend (Salesforce) into the picklist field. Query the
values from client side (Apex class) and pass into the server side but
value is not passing into the page. I put some alerts in server side and
could see the value but not displaying in page. Please look into the below
code. Is there any version problem? Do i need to install any file and
upload into salesforce?
Page:
<apex:page docType="html-5.0" standardStylesheets="false"
applyBodyTag="false" applyHtmlTag="false" cache="false" sidebar="false"
showHeader="false"
controller="AngularJS_Page3" >
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.0/angular.min.js"/>
<link
href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"
rel="stylesheet" media="screen"/>
<div ng-app="myapp">
<div ng-controller="mycontroller" ng-init="loadcourses()">
<div class="container">
<div class="page-header">
<label>Registration</label>
</div>
<div class="form-group">
<label>First Name <input type="text" class="form-control"
ng-model="name"/> </label><br/>
<label>Last Name <input type="text" class="form-control"/>
</label><br/>
<label>Male <input type="radio" /></label>
<label>Female <input type="radio" /></label><br/>
<label>Current Organisation <input type="text"
class="form-control"/> </label><br/>
<label>Designation <input type="text" class="form-control"/>
</label><br/>
<label>Technical Skills
<select class="form-control" multiple="select" ng-options="sk in
courses">
<span ng-bind="sk.name"/>
</select>
</label><br/>
</div>
</div>
<div>
<script type="text/javascript">
var app= angular.module("myapp",[]);
app.controller('mycontroller', ['$scope', function ($scope){
alert('krish');
$scope.courses=[];
$scope.loadcourses= function(){
alert('coursedetails');
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.AngularJS_Page3.Courseslist}',function(result){
$scope.courses=result;
alert('coursedetails---'+$scope.courses);
});
}
}]);
</script>
</div>
</apex:page>
Class:
public with sharing class AngularJS_Page3 {
@RemoteAction
public static list<spider__Training_Course__c> Courseslist() {
list<spider__Training_Course__c>clist= [select name from
spider__Training_Course__c limit 3];
return clist;
}
}
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" 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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.