Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Adding ngModel. #2904

Closed
wants to merge 1 commit into from
Closed

Adding ngModel. #2904

wants to merge 1 commit into from

Conversation

il-juggler
Copy link

look at this pull Request it implements the event ngModel.$setContext to especify the context should expression will be evaluated, example:

mod.directive('myFancyInput', function() {
  return {
    require : 'ngModel',
    scope : { ... hash ...},
    link : function(scope, element, attrs, ngModel) {
      ngModel.$setContext(scope.$parent);
    }
  }
})

@basarat
Copy link
Contributor

basarat commented Jul 3, 2013

Love this +1


this.$setContext = function(context) {
modelContext = context;
console.log('context setted', context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps you should send with this in a comment.

@chrismatheson
Copy link

@inzurrekt great workaround for what im seeing as a quite common and not very solvable problem. my ngModel dosent seem to have a $setContext though??

@pkozlowski-opensource
Copy link
Member

@inzurrekt Is the #1924 primary motivation for this change? If so it is more like a work-around as there are other directives that suffer from the same problem (ngShow, ngHide just to name the ones where people bump into the same problem the most often). The real issue is that currently a directive with an isolated scope makes all the other directives on the same DOM element to be evaluated in the isolated scope.

This is essentially the same PR as #3148

On top of this this PR:

  • has hard-coded console.log
  • doesn't have tests
  • doesn't have documentation update

@petebacondarwin
Copy link
Member

I agree with pawel - I think this needs to be fixed at a different level.

@pkozlowski-opensource
Copy link
Member

@inzurrekt Thnx for the work on this PR but it needs to be addressed differently. Going to close this one, we need to find a solution that would work for all the directives and not only ngModel

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants