Below is an image of my code's output; I know how to display data passed down from parent components (i.e., 100), but I don't know how to display the parental data via ng-model (i.e., 100 isn't displayed in the text box).
Here's my HTML and AngularJS code:
var app = angular.module('app', []);
app.component('parentComponent', {
controller: 'parentController'
})
.controller( 'parentController', function ($scope) {
var $ctrl = this;
$ctrl.object = { first: 100 };
})
app.component('childComponent', { // CHILD COMPONENT
bindings: { displayFirst: '=' },
template: `<div><label>Parent Value: </label>
<input type="text" ng-model="$ctrl.object.first">
</div>`,
controller: 'childController'
})
.controller('childController', function ($scope) {
var $ctrl = this;
$ctrl.object = { first: 25 };
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js"></script>
<body>
<div ng-app="app">
<div ng-controller="parentController as parent">
<div ng-controller="childController">
<child-component displayFirst="parent.object.first">
</child-component>
{{ parent.object.first }}
</div>
</div>
</div>
</body>
