Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Textangular box not getting model changes #64

Closed
worldspawn opened this issue Jan 3, 2014 · 11 comments
Closed

Textangular box not getting model changes #64

worldspawn opened this issue Jan 3, 2014 · 11 comments

Comments

@worldspawn
Copy link
Contributor

I have a model that looks a bit like:

{ comments : null }

This is referenced like so:

<div text-angular ng-model="commentResource.comment" id="description" name="description"></div>

Now i recreate the commentResource

$scope.commentResource = new commentResource();

The value shown in the text angular box is not updated. I've tried with a normal input type=text and the value is updated. I can work around this by explicitly setting the comment field to null after recreating the model... which is weird :)

$scope.commentResource = new commentResource();
$scope.commentResource.comment = null; //textangular binding issue
@mbarzeev
Copy link

mbarzeev commented Jan 6, 2014

+1

@mbarzeev
Copy link

mbarzeev commented Jan 6, 2014

It seems to be a focus issue of the editor.
removing the focus (any focus for that metter) before I've updated the model seemed to solve it, like so:

$( ":focus" ).blur();

Hope it helps.

@worldspawn
Copy link
Contributor Author

I'm updating model in response to a button click so the text angular widget should have already lost focus no? Or are you saying we just need a blur event somewhere (anywhere) in the dom?

@mbarzeev
Copy link

mbarzeev commented Jan 6, 2014

For me, pressing a different nested element on the view surprisingly didn't blurred the editor (see if it has the focus border to make sure).
Try what I've suggested above.

@SimeonC
Copy link
Collaborator

SimeonC commented Jan 6, 2014

Quick note - I have the fix prepped and will commit it when I can, internet is sporadic while I'm in India till the end of Jan. The issue is with the checks that prevent it from updating when ng-model is undefined. Removing those if statements seems to fix the issue but I have to go back and figure out why it was there in the first place.

@SimeonC
Copy link
Collaborator

SimeonC commented Jan 6, 2014

@matti I think the reason the editor toolbar buttons don't blur the editor is that they have unselectable set on them, else you wouldn't be able to keep typing after pressing one of the buttons.

@matti
Copy link

matti commented Jan 6, 2014

@SimeonC I believe you meant @mbarzeev

@mbarzeev
Copy link

mbarzeev commented Jan 6, 2014

hmmm... I don't think so ;)

@SimeonC
Copy link
Collaborator

SimeonC commented Jan 6, 2014

@matti yea thanks, It was a guess from the email name that came through.

@mbarzeev The focus issue is possibly unrelated, once the undefined bug is fixed clicking on a button that uses ng-click will clear the editor correctly due to the $digest that gets triggered. There's code in place to try prevent blur being triggered on the editor when an editor toolbar button is pressed (I assume this is what you meant by nested element on the view). If this isn't the case could you open a new issue with how to replicate it please?

@mbarzeev
Copy link

mbarzeev commented Jan 7, 2014

Nop, I didn't mean the toolbar buttons (they work as expected as far as I can tell), I'm talking about an issue where a nested element, external to the editor altogether, did not remove the focus from the editor itself. Weird, I know...
I don't believe I will have the time to create a nice Fiddle example, and I found a workaround (as mentioned above) which fixed it.
Still be be nice to know when the fix you we're referring to will be available.

Thanks for the help and responsiveness.

@worldspawn
Copy link
Contributor Author

Hullo, thanks for the fix. Its working like a charm.

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

No branches or pull requests

4 participants