Smart table st-safe-src attribute angularjs

I looked at this link http://lorenzofox3.imtqy.com/smart-table-website/ . But I have no precedent for "st-safe-src". when we need to use this attribute.

+6
source share
1 answer

I believe this explanation may help you with st-safe-src:

1) You have a displayed collection (i.e. a repeater) that will be the result of sorting, filtering, slicing operations in the base collection.

2) When the initialized smart table creates a copy of the provided st-table collection as the base collection. Thus, sorting, filter, slice are based on the original asset. When called using ajax, you do not have a dataset during initialization so that the base copy is actually incorrect. As a node side, I would rather get data when resolving the dependency controller (i.e. resolving on the route), this will facilitate your unit tests

3) When using st-safe-src, you explicitly tell smart-table to view and update its base collection, that is, the one that it uses as a reference when sorting, filtering, and slicing.

Thus, basically the st-table is the displayed collection (result), and st-safe-src is the base collection (the original data set).

So, if you set both values ​​to the same collection, the last one will be observed and the first will change, which will start the clock ... which will update the displayed text, etc.


Link: https://github.com/lorenzofox3/Smart-Table/issues/156#issuecomment-54242437

+4
source

Source: https://habr.com/ru/post/989061/


All Articles