I am completely new to Angular and I am attempting to build a table to display user information.
<div ng-controller="ContactController as cc" ng-app="MyApp" id="account-settings-page">
<div class="slds manage-account-table">
<table class="slds-table slds-table--bordered slds-table--striped">
<thead>
<tr class="slds-text-heading--label" role="header">
<th data-label="staffName" class="slds-is-sortable">Selected Portal User</th>
<th data-label="title">Title</th>
<th data-label="email">Email</th>
<th data-label="phone">Portal Admin</th>
</tr>
</thead>
<tbody ng-model="users">
<tr ng-repeat="user in users" class="slds-hint-parent">
<td data-label="contactName">
<select class="slds-select" ng-model="users">
<option value="{{user.contactName}}" ng-repeat="user in users">{{user.contactName}}</option>
</select>
</td>
<td data-label="contactTitle">{{user.contactTitle}}</td>
<td data-label="contactEmail">
<div>{{user.contactEmail}}</div>
</td>
<td data-label="isPortalAdmin">
<div class="impact-thesis-checkbox">
<div class="slds-form--stacked">
<div class="radio">
<label><input type="radio" name="optradio" ng-checked="{{user.isPortalAdmin}}"></label>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
JavaScript:
angular
.module('MyApp',[])
.controller('ContactController', function($scope) {
var self = this;
self.data = {
"users": [{
"userId": "001290000031Xp0",
"userName": "Joe Salademaier",
"contactId": "001290000031Xp0",
"contactName": "Joe Salademaier",
"contactTitle": "CEO",
"contactEmail": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4d2722280d223f2a2c2324372c3924222363223f2a">[email protected]</a>",
"isPortalAdmin": true,
"isUser": true
}, {
"userId": "001290000031Xp0",
"userName": "Anastasia Smith",
"contactId": "001290000031Xp0",
"contactName": "Anastasia Smith",
"contactTitle": "CTO",
"contactEmail": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="147567797d607c547b6673757a7d6e75607d7b7a3a7b6673">[email protected]</a>",
"isPortalAdmin": false,
"isUser": true
}, {
"userId": "001290000031Xp0",
"userName": "Bill Salademaier",
"contactId": "001290000031Xp0",
"contactName": "Bill Salademaier",
"contactTitle": "CMO",
"contactEmail": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b494247476b44594c4a4542514a5f4244450544594c">[email protected]</a>",
"isPortalAdmin": false,
"isUser": true
}, {
"userId": "001290000031Xp0",
"userName": "Joe Schmope",
"contactId": "001290000031Xp0",
"contactName": "Joe Schmope",
"contactTitle": "VP Finance",
"contactEmail": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="24464d4848644b5643454a4d5e45504d4b4a0a4b5643">[email protected]</a>",
"isPortalAdmin": false,
"isUser": true
}, {
"userId": "001290000031Xp0",
"userName": "Jill Meiser",
"contactId": "001290000031Xp0",
"contactName": "Joe Salademaier",
"contactTitle": "VP Marketing",
"contactEmail": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6a080306062a05180d0b0403100b1e0305044405180d">[email protected]</a>",
"isPortalAdmin": false,
"isUser": true
}, {
"userId": "",
"userName": "",
"contactId": "001290000031Xp0",
"contactName": "Rajesh Gupta",
"contactTitle": "Developer",
"contactEmail": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b4c6d5def4d5d8c3d5cdc79adbc6d3">[email protected]</a>",
"isPortalAdmin": false,
"isUser": false
}, {
"userId": "",
"userName": "",
"contactId": "001290000031Xp0",
"contactName": "Jill Sedelmaier",
"contactTitle": "Senior Consultant",
"contactEmail": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4d272421210d23283b283f63223f2a">[email protected]</a>",
"isPortalAdmin": false,
"isUser": false
}]
};
$scope.users = self.data.users;
});
I am struggling to populate a dropdown menu with the correct values for each user. Although I have managed to fill in the remaining columns, the first column continues to be a challenge. I have two inquiries: 1. How can I assign the proper values to the dropdown for every user? 2. How do I ensure that the row values adjust when a different user is selected?
Here is my attempt on Codepen : http://codepen.io/Gromit/pen/qbwmvZ