मैं एक घटक से दूसरे घटक में एक मूल्य पारित करने की कोशिश कर रहा हूं।कोणीय जेएस - घटक को पास मूल्य
स्थान सूची
<div uib-accordion-group class="panel-default" heading="{{location.name}}" ng-repeat="location in $ctrl.locations">
<p>This is from location list: {{location.id}}</p>
<bike-list locationId="{{location.id}}"></bike-list>
</div>
आउटपुट:
इस स्थान सूची से है: 1
स्थान आईडी है:
बाइक सूची
बाइक-list.component.js
angular
.module('bikeList')
.component('bikeList', {
templateUrl: 'bike-list/bike-list.template.html',
controller: ['$rootScope', function ($rootScope) {
var self = this;
self.bikes = $rootScope.currentBikes;
}],
bindings: {
locationId: '<'
}
});
बाइक-list.template.html
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<p>Location id is : {{$ctrl.locationId}}</p>
</body>
आउटपुट:
स्थान आईडी है:
प्रश्न
- मैं स्थान कैसे प्राप्त कर सकता हूं बाइक सूची में?
इसके लिए धन्यवाद। मुझे बहुत प्रयास बचाया –