0

Im new to AngularJS but I am struggling with getting data in an array to come out via the scope into the view. I have an array and I am trying to get each specific item to come out such as 'Costs Summary By Job Type'

Any help would be much appreciated

Here is the Angular:

 $scope.lynchMenu = [
  { MenuFunction: 'Interact', MenuText: 'Job Status YTD Summary',                   MenuObject: 'JobStatusYTDSummary',                  MenuType: 'Report', MenuActive: 1, MenuOrder: 1 },
  { MenuFunction: 'Interact', MenuText: 'Costs Summary By Customer',                MenuObject: 'CostsSummaryByCustomer',               MenuType: 'Report', MenuActive: 1, MenuOrder: 2 },
  { MenuFunction: 'Interact', MenuText: 'Costs Summary By Job Type',                MenuObject: 'CostsSummaryByJobType',                MenuType: 'Report', MenuActive: 1, MenuOrder: 3 },
  { MenuFunction: 'Interact', MenuText: 'Costs Summary By Management Company',      MenuObject: 'CostsSummaryByManagementCompany',      MenuType: 'Report', MenuActive: 1, MenuOrder: 4 },
  { MenuFunction: 'Interact', MenuText: 'WIP Summary By Management Company',        MenuObject: 'WIPSummaryByManagementCompany',        MenuType: 'Report', MenuActive: 1, MenuOrder: 5 },
  { MenuFunction: 'Interact', MenuText: 'WIP Detail By Management Company',         MenuObject: 'WIPDetailByManagementCompany',         MenuType: 'Report', MenuActive: 1, MenuOrder: 6 },
  { MenuFunction: 'Interact', MenuText: 'Incomplete Jobs By Management Company',    MenuObject: 'IncompleteJobsByManagementCompany',    MenuType: 'Report', MenuActive: 1, MenuOrder: 7 },

]; //LynchMenu Layout

Here is the HTML

 <div class="panel-body">
            <ul class="list-unstyled"> 
            <li ng-repeat="MenuObject in lynchMenu">  
                    {{MenuObject}} <!--Data-binding expression -->
                </li><!--List-->      
            </ul><!--Unordered List-->
        </div><!--Panel Body-->
4
  • {{MenuObject.MenuText}} Commented Jul 15, 2015 at 11:37
  • I suppose there is a ng-controller directive? Commented Jul 15, 2015 at 11:38
  • @pbrownlee88 For learning AngularJS, you must know JavaScript, HTML, and how to deal with the DOM. Commented Jul 15, 2015 at 11:40
  • you probably should post a better title next time explaining what you're struggling with Commented Jul 15, 2015 at 11:58

2 Answers 2

1

You are missing the property name. Try..

DEMO

<div class="panel-body">
            <ul class="list-unstyled"> 
            <li ng-repeat="MenuObject in lynchMenu">  

                    {{MenuObject.MenuText}} <!--Data-binding expression -->

                </li><!--List-->      
            </ul><!--Unordered List-->
        </div><!--Panel Body-->
Sign up to request clarification or add additional context in comments.

1 Comment

Glad to help. Could you please mark it as the accepted answer if you feel that it solved your problem.
0

Specify the property with object that you want to show on html

<div class="panel-body">
            <ul class="list-unstyled"> 
            <li ng-repeat="MenuObject in lynchMenu">  
                    {{MenuObject.MenuText}} {{MenuObject.MenuType}} {{MenuObject.MenuActive}} <!--Data-binding expression -->
                </li><!--List-->      
            </ul><!--Unordered List-->
        </div><!--Panel Body-->

For filteration ng-repeat you can use filter of angularjs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.