Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

No changes detected on nested fields #258

Closed
Assignees
jmdobry
Labels
@mattlewis92

Description

@mattlewis92

First off, great library, it's easily the best of it's kind and makes working with REST APIs so much easier.

I've noticed that changes on properties that are objects aren't being picked up by the previous() method and consequently the hasChanges() method.

For example I have a user model where the data is:
{name: {first: 'Name'}, email: 'test@fake.com'}

If I change the email property, the functions behave correctly, however if I change name.first, hasChanges() returns false, and previous() returns the modified document.

The bug seems to be caused in the inject method, as the references to the original objects are being saved in the previous attributes. Using angular.copy() to save the previousAttributes appears to do the trick.

The diffObjectFromOldObject method then needs updating to detect changes in objects. Changing:

if(newValue!==oldObject[prop]){

to

if(!angular.equals(newValue,oldObject[prop])){

seems to do the trick.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp