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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:12:24+00:00 2026-06-13T13:12:24+00:00

so this is how it looks like, and here is the Plunker parent scope

  • 0

so this is how it looks like, and here is the Plunker

parent scope 
   ng-repeat
       directive

in the directive there is an attribute is bi-directional binding with a variable in parent scope.

But this doesn’t work as I wanted.(But I can understand why it doesn’t work)

The reason is ngRepeat will create it’s own scope, so once the variable is changed in directive, Angular add a variable in ngRepeat, but it leave the variable in parent unchanged.

I can do something like scope.$parent.$parent.variable to change the variable, but it is kinda not the idea in Angular.

How should I do ?

Moreover, if I change the repeated item in the items collection, the item can’t be changed.

Because of the same reason above.

  • 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-13T13:12:25+00:00Added an answer on June 13, 2026 at 1:12 pm

    EDIT (again): It looks like the issue is you need to have reference types in your array, such as objects or arrays.

    Gloopy was exactly right in the comments. The bi-directional binding wasn’t working because it seems like Angular was creating copies of your primitives types (strings, numbers, etc) between the second scope pairing. So… when you have a nesting of bi-directionally bound primitive types between two scopes it’s fine because it uses one instance, but when you nest it more than one deep, it creates a copy of the primitive and you’re no longer updating the same instance.

    Here’s a new demo

    app.controller('MainCtrl', function($scope) {
      $scope.items = [
        { text: 'apples' },
        { text: 'bananas' },
        { text: 'oranges' }
      ];
      $scope.addItem = function(){
        $scope.items.push({ text: 'test' });
      };
    });
    
    app.directive('test', function(){
      return {
        restrict: 'E',
        scope: {
          foo: '=foo'
        },
        template: '<div>{{foo}} <a ng-click="bar()">bar</a></div>',
        controller: function($scope){ 
          $scope.bar = function() {
            $scope.foo += '!';
          };
        }    
      };
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My javascript function looks like this - function updateSuccess(aEle) { //Here aEle doesn't have
I have some HTML that looks like this: <div class=product> Content In Here <div
Noob question here! I have an array with hashes that looks like this: arr
Here is the situation. I have some javascript that looks like this: function onSubmit()
Not sure what's going on here... My controller methods looks like this: [HttpGet] public
I have a div tag which looks something like this: <div id=some id here
This looks like a long shot, but does anyone know of a way to:
This looks like a very simple issue, but I just can't get it to
I am a bit lost, this looks like some silly mistake - but I
This looks like a long question because of all the context. There are 2

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.