angularjs - angularfire binding to primitive -


I'm trying to bind with an accidental here's how I'm doing it:

  $ firebase (fb.child ('calculation / node')). $ ('Value' is $$ scope.nodeCount = Obj.snapshot.value}) at function (obj)  

Is that correct? This API is very different from the rest of the Firebus. I expect to get an SS as a callback and ss.val () but this does not seem like it. Can someone confirm whether it is or is it going wrong? Thank you.

itemprop = "text">

Generally, as mentioned in the above, you should get the view in the data directly: < / P>

  // javascript $ scope.messages = $ firebase (new firebase (url)); & Lt ;! - html - & gt; & Lt; Li ng-repeat = "Message in message" & gt; {{Message}} & lt; / Li & gt;  

If you want to iterate the data in a controller (bad) or service (better), you can read the key in the form of a database by using $ getIndex () .

  // javascript var ref = $ firebase (newfile rebase (url)); Referee [$] ('loaded', function) (but) (angular.forEach (get. $ GetIndex), function (key) {console.log ('next message, key, referee [key]);}); });  

If you are actually trying to synchronize a single primitive value, angular flaming is rarely required:

  $ scope. Primitive = null; Var ref = new firefighter (url); Ref.on ('value', function (snap) {$ scope.primitive = snap.val ();}); $ Scope.saveValue = function (new value) {ref.set (newValue); };  

But it is definitely possible:

  // javascript $ scope.primitive = $ firebase (new firebase (url)); & Lt ;! - html - & gt; & Lt; Input ng-model = "primitive. Value" />  

All this is included in the above links, which should be considered essential reading before starting with the Conneller + Firebase.

Changes in 0.8

Angular Fire 0.8 will end soon. This will change this structure slightly, using $ asArray (), $ asObject (), and also a .then () method, so anything else like this:

  // Javascript var ref = $ firebase (new firebase); $ Scope.messages = Refunds $ asArray (); $ Scope.ref.then (function () {angular.forEach ($ scope.messages, function (message) {console.log ('next message, message. $ Id);});}); & Lt ;! - html - & gt; & Lt; Li ng-repeat = "Message in message" & gt; {{Message}} & lt; / Li & gt;  

Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

import - Python ImportError: No module named wmi -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -