Note that there are some explanatory texts on larger screens.

plurals
  1. POUI is not get updated with data after success
    primarykey
    data
    text
    <p>I am new to Breeze and i am creating a sample to learn. I am facing an issue. I have create a <strong>datacontext.js</strong> in which i have added the breeze code to get data from service like below</p> <pre><code>sample.factory('datacontext', ['breeze', 'Q', '$timeout', '$q', function (breeze, q, timeout, $q) { configureBreeze(); var manager = new breeze.EntityManager("/breeze/ProductsBreeze"); manager.enableSaveQueuing(true); var datacontext = { metadataStore: manager.metadataStore, getTodoLists: getTodoLists }; function getTodoLists(onsuccess) { var query = breeze.EntityQuery.from("GetAllProducts"); manager.executeQuery(query).then(onsuccess); }; return datacontext; //function getSucceeded(data) { // return data.results; //} function configureBreeze() { breeze.config.initializeAdapterInstance("modelLibrary", "backingStore", true); // configure to use camelCase breeze.NamingConvention.camelCase.setAsDefault(); } }]); </code></pre> <p>now in <strong>getTodoLists</strong> i am passing a callback <strong>onsuccess</strong>. Here is my controller</p> <pre><code>sample.controller('todoBreeze', ['datacontext', '$scope', '$log', function (datacontext, $scope, log) { $scope.heading = "Hello World"; $scope.Products = []; datacontext.getTodoLists(function (data) { $scope.Products = data.results; log.info($scope.Products); }); $scope.editProduct = function (pid, index) { }; $scope.deleteProduct = function (pid, index) { }; }]); </code></pre> <p>now the problem is that its show that i have two records (showing in console) in my array after completed the request but UI is not get updated if i use</p> <pre><code>&lt;span&gt;{{Products.length}}&lt;/span&gt; </code></pre> <p>but if i call <code>$scope.$apply()</code> after request completed then its works fine. </p> <p>Can you please let me know what is the error in my code.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload