Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Two-way binding with JSON breaks the extension #282

Closed
RopoMen opened this issue Nov 19, 2015 · 1 comment
Closed

Two-way binding with JSON breaks the extension #282

RopoMen opened this issue Nov 19, 2015 · 1 comment

Comments

@RopoMen
Copy link

RopoMen commented Nov 19, 2015

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
Copy link
Member

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.

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

No branches or pull requests

2 participants