Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:37:32+00:00 2026-06-15T05:37:32+00:00

I am trying to create a form part of which is a table that

  • 0

I am trying to create a form part of which is a table that loops over a list of objects and for each object allows the user to check/uncheck attributes. The rest of the form works fine but I am having trouble setting the ng-model attribute on the checkboxes.

Here’s what I have:

<table>
    <thead>
        <tr>
            <td>Objects and Fields</td>
            <td>Createable</td>
            <td>Deleteable</td>
            <td>Readable</td>
            <td>Updateable</td>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="object in myAppObjects">
          <td>
            {{object.name}}&nbsp;{{object.id}}
            <input type="checkbox" name="app_access_{{object.id}}" ng-model="app_access" value="false">
          </td>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
      </tbody>
</table>

At first I tried setting the ng-model=”app_access_{{object.id}}” so that I would have a unique ng-model for each cell. This caused the table row to be repeated several dozen times. Each of those empty cells will also have a check box. There will be five check boxes for each object and several objects in the form at a given time. I’ll need to be able to access each check box (or better yet a list of the checked ones) in the controller.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:37:33+00:00Added an answer on June 15, 2026 at 5:37 am

    Since ngRepeat creates a new (child) scope for each item, creating new ng-models (that are tied to those new scopes) for the items will not work because those models/data will only be accessible inside those inner scopes. We can’t write a controller function to access those inner/child scopes. It is better to reference something in myAppObjects for the models (like @Max suggests in his second example).

    If myAppObjects looks something like this:

    $scope.myAppObjects = [
      {id: 1, cb1: true,  cb2: false, cb3: true, cb4: true,  cb5: false },
      {id: 2, cb1: false, cb2: false, cb3: true, cb4: false, cb5: true  },
    

    You could write your ng-repeat like this:

    <tr ng-repeat="appObj in myAppObjects">
        <td>{{appObj.id}}
            <input type="checkbox" ng-model="appObj.cb1"></td>
        <td><input type="checkbox" ng-model="appObj.cb2"></td>
        <td><input type="checkbox" ng-model="appObj.cb3"></td>
        <td><input type="checkbox" ng-model="appObj.cb4"></td>
        <td><input type="checkbox" ng-model="appObj.cb5"></td>
    </tr>
    

    Working fiddle: http://jsfiddle.net/mrajcok/AvGKj/

    Bottom line: we need to have the checkbox models defined in/on the parent scope (in my fiddle, MyCtrl’s $scope), and not in/on the ngRepeat inner/child scopes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a form that based on the users input would determine
I'm trying to create a form that clients would complete via the web, so
Using C#, I'm trying to create a form with a dataGridView that shows the
I'm trying to create a custom form input that utilizes some images, it should
I am on the Django tutorial (part 4) and trying to create a form
I'm trying to create a page with two functional parts: a form which the
I'm trying to create a simple form which calculates the values in every input
i'm trying to create form which with which i can upload text and image
I'm trying to create a very basic chat system, part of which will be
I am trying to create a nested attribute form to create a model which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.