M
M
Maxim Ivanov2016-10-20 17:25:20
Angular
Maxim Ivanov, 2016-10-20 17:25:20

How to pass an object to a component?

The thing is, I want to pass a whole object during ng-repeat

<div ng-repeat="entity in $ctrl.data">

<controll process-step-id="{{ $ctrl.data.processstepid }}"
              code="{{ entity.code }}" 
              id-in-pool="{{ entity.idInPool }}"
              entity=" entity "> <!-- вот тут я хочу передать целый объект
        </controll>

</div>

the component itself is initialized like this:
const inputController = {

  bindings: {
       'processStepId': '@', // состояние
       'code': '@', // состояние
       'idInPool': '@', // состояние
       'entity': '=', // передаем объект
    },

    controller: ($scope, $element, $attrs) => { 

    	console.log($attrs)

  },

    template: require('./view/blocks/inputController.html')

};

But in the end, just a string of entity text is
f92c8bdc465a4bdc9ab1019c3dc98580.png
passed if passed like this {{ entity }} - then the compilation error says
b336a52683074a578f85611a5f3127e3.png
What to do?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question