angular / batarang

AngularJS WebInspector Extension for Chrome
MIT License
2.43k stars 337 forks source link

Two-way binding with JSON breaks the extension #282

Closed RopoMen closed 8 years ago

RopoMen commented 8 years ago

Hi,

I was trying to get some performance results for one page which had this kind of solution jsfiddle That works fine and main idea is that that directive has only one interface how it is used. It can be used from other AngularJS view templates with Two-way binding, BUT it can also be used from server side. For example CMS environment where AngularJS directive is initialized using JSON string, like in this example. Everything works normally, but when I refreshed the page and enabled this extension whole page breaks :)

I get following error "Error: $compile:nonassign Non-Assignable Expression" "Description This error occurs when a directive defines an isolate scope property (using the = mode in the scope option of a directive definition) but the directive is used with an expression that is not-assignable.

In order for the two-way data-binding to work, it must be possible to write new values back into the path defined with the expression."

Br, Markku ps. you may need to copy-paste the example for some other environment to get the extension to see that app, because jsfiddle works inside iframe.

SomeKittens commented 8 years ago

This isn't a Batarang issue, this is how Directives work. The = operator means you need to pass in a variable (attached to parent scope), not just raw JSON.