You need to sign in to do that
Don't have an account?
Dominic Sebastian
dynamic drop down using the id and name in angular JS
Hi I would like to display dynamically the drop down of the id and name in angular JS. Please let me know how here is the code.
thanks
// In the controller SafetyAuditController @RemoteAction global static string searchProject(string sSiteId){ // id myId1 = UserInfor.getUserId(); // system.debug(myId1); Site__c Site1 = [Select Id, Name , Project__c, Project__r.Name,Site_Master__r.Name, Site_Master__r.Id From Site__c where Site_Master__r.Id = :sSiteId LIMIT 4]; return Site1.Project__r.Name; // here I am only displaying the name I must also // display the id. } // In the angular Javascript // the app.service this.SearchProject = function(siteId){ var deferred = $q.defer(); Visualforce.remoting.Manager.invokeAction('SafetyAuditController.searchProject', siteId, function(retVal, e) { $rootScope.$apply(function() { deferred.resolve(retVal.lSite[0]); }); }, {escape:true} ); return deferred.promise; }; //the function search Project var promiseProjects = SiteSvc.searchProject($scope.siteId); promiseProjects.then( function (retVal){ console.log(retVal); $scope.searchProj =[ { name : retval} ] }); // on the Visualforce page, which I should also display the id <div ng-controller = "Ctrl_SafetyAuditSection"> <p> You have selected:{{searchProj}} </p> <div dropdown-select = "searchProj" dropdown-model="searchProj" dropdown-item-label="text"> </div> </div>the Site Master object is the lookup relationship with the site object hence I need to fetch the site master id to process the query.
thanks