A
A
Alexander Karpov2017-09-07 11:05:44
Angular
Alexander Karpov, 2017-09-07 11:05:44

Why doesn't Alight respond to state changes?

in theory this should work:

<div al-app="mainCtrl" >
            <div al-init="search={}">
                Name: <input type="text" al-value="search.name" /> <br/>
                Age: <input type="text" al-value="search.age" /> <br/>
            </div>
            <table class="table table-bordered">
                <tr al-repeat="it in list | smart:search">
                    <td>{{=it.name}}</td>
                    <td>{{=it.age}}</td>
                </tr>
            </table>
        </div>

but when i change the values ​​in the input then al-repeat doesn't rebuild the house
like this works:
<div al-app="mainCtrl" >
            <div al-init="search={}">
                Name: <input type="text" al-value="search.name" /> <br/>
                Age: <input type="text" al-value="search.age" /> <br/>
            </div>
            <table class="table table-bordered">
                <tr al-repeat="it in list | smart:search.name">
                    <td>{{=it.name}}</td>
                    <td>{{=it.age}}</td>
                </tr>
            </table>
        </div>

but this option does not allow you to pass the entire object to the filter in
the JS code here:
alight.controllers.mainCtrl = function(scope) {
                scope.list = [{name:'Alex',age:35},{name:'Masha',age:28}];

            };
            alight.filters.smart = function (name, scope) {
                console.log(name, scope);
            }

I really wanted to use this library in the project, but something is not clear. The previous version allows you to do something that I want, but other examples from the documentation do not work.
version 0.14

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vintage, 2017-09-07
@Inkognitoss

Why not ask the author of the library? angularlight.org/community.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question