Skip to content

Instantly share code, notes, and snippets.

@jongravois
Created September 2, 2014 16:34
Show Gist options
  • Save jongravois/74e9bd4a290b3f2e19db to your computer and use it in GitHub Desktop.
Save jongravois/74e9bd4a290b3f2e19db to your computer and use it in GitHub Desktop.
Illustrates Angular Error
<!--I am consuming an API feed and want to repeat a table row for each crop returned. I am doing something wrong.-->
<!-- here is the html that should print a single row of data -->
<table class="table striped-table">
<tr>
<th style="width:20%;text-align:left;">Crop</th>
<th style="width:10%;">{{globals[0].g_crop_year -1}}</th>
<th style="width:10%;">{{globals[0].g_crop_year -2}}</th>
<th style="width:10%;">{{globals[0].g_crop_year -3}}</th>
<th style="width:10%;">3yr Average</th>
<th style="width:10%;">{{globals[0].g_crop_year -4}}</th>
<th style="width:10%;">{{globals[0].g_crop_year -5}}</th>
<th style="width:10%;">{{globals[0].g_crop_year -6}}</th>
<th style="width:10%;">6yr Average</th>
</tr>
<tr ng-repeat="c in loan.cropdetails">
<td>{{c.crop_id}}</td>
<td style="text-align: center;">700</td>
<td style="text-align: center;">650</td>
<td style="text-align: center;">600</td>
<td style="text-align: center;">650</td>
<td style="text-align: center;">550</td>
<td style="text-align: center;">500</td>
<td style="text-align: center;">450</td>
<td style="text-align: center;">500</td>
</tr>
</table>
<!--
This is the entire feed which is stored in a $scope variable called loan:
{
id: "1",
app_date: "2014-07-04",
loan_type_id: "2",
loan_type: "Ag-Input",
crop_year: "2015",
season: "S",
loc_id: "4",
loc_abr: "RAY",
user_id: "1",
analyst: "JWG",
farmer_id: "1",
farmer: "Stark, Tony",
applicant_id: "1",
applicant: "Stonebridge Manor",
status_id: "3",
region_id: "3",
region: "Mid-West",
is_stale: "0",
need_vote: "1",
has_comment: "0",
plant_own: "0",
harvest_own: "1",
equip_obligations: "1",
other_cash: "1",
fsa_good: "1",
fci_good: "1",
premiums_past: "0",
premiums_details: null,
legal_defendant: "0",
defendant_details: null,
judgments: "0",
judgment_details: null,
bankruptcy: "1",
bankruptcy_details: null,
bankruptcy_order: "0",
liens: "0",
liens_details: null,
fsa_direct_pay: "0",
fsa_direct_pay_details: null,
future_liabilities: "0",
credit_3p_available: "0",
credit_3p_details: null,
income_percent: null,
distributor: null,
pesticide_number: null,
affiliated_entities: null,
farm_supplier_creditors: null,
its_list: "1",
fsa_compliant: "1",
has_liens: "1",
valid_leases: "1",
third_party_credit: "1",
recommended: "1",
arm_approved: "1",
dist_approved: "1",
loan_closed: "1",
loan_closed_date: "2014-07-15",
arm_balance: "0",
added_land_verified: "1",
arm_ucc: "1",
dist_ucc: "1",
aoi_received: "1",
ccc_received: "1",
rebate_assignment: "1",
limit_warning: "1",
crop_inspection: "0",
reconcilliation: "1",
account_classification: "1",
paid: "1",
attachments: "1",
addendum: "1",
comments: "1",
bankruptcy_history: null,
required_3party: "1",
added_land_done: "1",
controlled_disbursement: "1",
loan_paid: "1",
perfected_attachments: "1",
farms: [
{
id: "1",
loan_id: "1",
county_id: "199",
fsn: "65554TR",
owner: "Clemmens, Samuel",
share_rent: "80",
cash_rent: "1250",
waived: "0",
when_due: "15th of month",
irr: "0",
ni: "1",
facirr: "0",
facni: "1",
fsa_paid: "0"
},
{
id: "2",
loan_id: "1",
county_id: "199",
fsn: "65548SL",
owner: "Clemmens, Samuel",
share_rent: "60",
cash_rent: "1000",
waived: "0",
when_due: "1st of month",
irr: "1",
ni: "0",
facirr: "1",
facni: "0",
fsa_paid: "500"
},
{
id: "3",
loan_id: "1",
county_id: "190",
fsn: "65198ZL",
owner: "Poe, Edgar",
share_rent: "40",
cash_rent: "850",
waived: "0",
when_due: "last of month",
irr: "1",
ni: "1",
facirr: "1",
facni: "0",
fsa_paid: "0"
},
{
id: "4",
loan_id: "1",
county_id: "103",
fsn: "9006DFA",
owner: "Reb, John",
share_rent: "100",
cash_rent: "0",
waived: "0",
when_due: "harvest",
irr: "1",
ni: "0",
facirr: "0",
facni: "1",
fsa_paid: "0"
}
],
cropdetails: [
{
id: "1",
loan_id: "1",
crop_id: "5",
towhom_market: "Bayless Greens",
future_liable_quantity: "0",
future_liable_amount: "0",
gin_mill: "Bayless Gin",
rebate: "0",
crop: {
id: "5",
crop: "cotton"
}
}
]
}
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment