Search Posts

Category: angularjs-components

Sharing data between Angularjs components

I’m trying to refactor an Angularjs 1.4 webapp to use components. The webapp has a header with a “Search” input box: the main section shows a list of contacts filtered according to the value entered in the Search input text. I’m trying to use ui-router (to switch from list to details. I’ve created Header and Index component, defined a service in which I store the Search value, defined a state app.index with “resolve” that calls […]

Angular 1.5 ng-change on select element in component triggering previous response

I’m just starting to play with components in Angular 1.5.x and have created one for a select box on a form – I pass in the field, list and label to the component and it creates the form ‘part’ consisting of the label and select box with the correct options – so far, so good. Now I want to implement an ng-change on the select so I am passing in the function I want to […]

Change to parent component array with ngRepeat doesn’t trigger child $onChanges

I’m working with parent and child components. The child-component is one-way data bound (‘<‘) to a value that comes via an ng-repeat over an array in the parent component. <li ng-repeat=”item in $ctrl.items”> <child-component item=”item”></child-component> </li> And the component: var childComponent = { bindings: { item: ‘<‘ }, controller: ‘ChildComponentController’, template: ‘<div>{{ $ }}</div>’ } Perhaps I’ve misunderstood how $onChanges is supposed to work, but it seems like updating an item in the parent controller’s […]