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 8976751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:13:00+00:00 2026-06-15T19:13:00+00:00

Please look at http://jsfiddle.net/mahbub/sbNty/4/ <div ng-app=> <div ng-controller=Ctrl> <ul> <li ng:repeat=status in statuses><label><input type=checkbox

  • 0

Please look at http://jsfiddle.net/mahbub/sbNty/4/

<div ng-app="">
  <div ng-controller="Ctrl">
        <ul>
            <li ng:repeat="status in statuses"><label><input type="checkbox" data-ng-model="status.type" data-ng-true-value="closed" data-ng-false-value="{{status.type}}" />{{status.type}}</label></li>
      </ul>
  </div>
</div>​

As you can see the label of the checkboxes are printed based on the status type from the JSON. Now on unchecking, the label becomes false. I must be missing some correct way to get back to the originial label text upon unchecking the checkbox.

I mean when I uncheck, the label needs to be “open” or whatever it was initially.

Any help is greatly appreciated.

Thanks

  • 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-15T19:13:01+00:00Added an answer on June 15, 2026 at 7:13 pm

    Finally i did it using ngInit and setting a different variable within the scope object. See the demonstration here http://jsfiddle.net/mahbub/sbNty/5/

    <div ng-app="">
      <div ng-controller="Ctrl">
            <ul>
                <li ng:repeat="status in statuses"><label><input ng-init="status.oldStat=status.type" type="checkbox" ng-model="value" ng-click="selectV(value,this)">{{status.type}}</label></li>
          </ul>
      </div>
    </div>​
    

    Controller :

    'use strict';
    
    function Ctrl($scope) {
        $scope.statuses = [{
            id: 1,
            type: 'open'},
        {
            id: 2,
            type: 'open'},
        {
            id: 3,
            type: 'new'},
        {
            id: 4,
            type: 'closed'},
        {
            id: 5,
            type: 'open'},
        {
            id: 6,
            type: 'new'},
        {
            id: 7,
            type: 'open'}
    ];
    
        $scope.selectV = function(val, stat) {
            if (val) {
                stat.status.type = "closed";
            } else {
                stat.status.type = stat.status.oldStat;
            }
        }
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please take a look at this jsFiddle: http://jsfiddle.net/omarjuvera/TpWNY/#base I would like <div class=client> to
Please take a look at this fiddle: http://jsfiddle.net/hughbe/QYGcq/ As you can see, the label
Please look at this fiddle: http://jsfiddle.net/dyv88/16/ On IE7, if I put width: 100% on
please look at this example of drop down checkbox list im working on.. http://jsfiddle.net/Yojik/VJHVK/143/
could somebody please take a look at this http://jsfiddle.net/bloodygeese/EzkFR/1/ My aim is to on
Hi please take a look at this fiddle http://jsfiddle.net/bloodygeese/pwjNQ/1/ I am trying to figure
I have created a little example,please have a look, http://jsfiddle.net/bWTwL/ I want to have
can someone take a look at this please http://jsfiddle.net/bloodygeese/ecscY/56/ it looks like I have
Please take a look here: http://jsfiddle.net/ZUd27/7/ What I need: There are several elements. One
Please take a look at this simple code: http://jsfiddle.net/kerp3/ The box has an inner

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.