Javascript 如何将$ctrl值从一个位置传递到另一个组件
我正在使用AngularJS(1.6)应用程序。在我的应用程序中,我有一些组件- OprExternalInstructionApp-> oprScriptListPanel-> 我的Javascript 如何将$ctrl值从一个位置传递到另一个组件,javascript,angularjs,html,Javascript,Angularjs,Html,我正在使用AngularJS(1.6)应用程序。在我的应用程序中,我有一些组件- OprExternalInstructionApp-> oprScriptListPanel-> 我的oprScriptListPanel模板文件中有组件。我在中传递$ctrl.externalInstructionsFiltered 如items=“$ctrl.externalInstructionsFiltered” 但是我没有看到{{$ctrl.externalInstructionsFiltered}}在我
oprScriptListPanel
模板文件中有
组件。我在
中传递$ctrl.externalInstructionsFiltered
如items=“$ctrl.externalInstructionsFiltered”
但是我没有看到{{$ctrl.externalInstructionsFiltered}}
在我的模板oprScriptListPanel
中有任何数据
我的模板代码-
<opr-script-list-panel
items="$ctrl.externalInstructionsFiltered"
toolbar-buttons="$ctrl.toolbarButtons"
selected-items="$ctrl.selectedInstructions"
on-search="$ctrl.filterExternalInstructionsChanged(text)"
on-double-click="$ctrl.edit(item)"
item-actions="$ctrl.itemActions"
item-tags="$ctrl.itemTags"></opr-script-list-panel>
opr脚本列表面板的组件文件
import './oprScriptListPanel.template.html';
var oprScriptListPanelComponent = {
templateUrl: 'oprScriptListPanel.template.html',
bindings: {
toolbarButtons: "<?",
selectedItems: "@?",
onSearch:"&?",
items:"=?",
data:"=ngModel",
oprListDeleteMode:"&?",
onDoubleClick:"&?",
itemActions:"&?",
itemTags:"&?"
}
};
export default oprScriptListPanelComponent;
导入“/oprScriptListPanel.template.html”;
变量oprScriptListPanelComponent={
templateUrl:'oprScriptListPanel.template.html',
绑定:{
工具栏按钮:“你的问题很难理解。你能重新措辞吗?是的,当然。我无法将$ctrl值从一个模板传递到另一个组件。@CosminAbabei更新了我的问题,请检查。。我仍然觉得很难理解。。。
import './oprScriptListPanel.template.html';
var oprScriptListPanelComponent = {
templateUrl: 'oprScriptListPanel.template.html',
bindings: {
toolbarButtons: "<?",
selectedItems: "@?",
onSearch:"&?",
items:"=?",
data:"=ngModel",
oprListDeleteMode:"&?",
onDoubleClick:"&?",
itemActions:"&?",
itemTags:"&?"
}
};
export default oprScriptListPanelComponent;
<div>
<opr-toolbar
buttons="$ctrl.toolbarButtons"
selected-items="$ctrl.selectedInstructions"
filter-placeholder="Filter instructions"
on-search="$ctrl.filterExternalInstructionsChanged(text)"
show-first-separator="true">
</opr-toolbar>
</div>
<div class="empty-info" ng-if="$ctrl.externalInstructionsFiltered && !$ctrl.externalInstructionsFiltered.length">
<p ng-bind=":: 'opr.external.instructions.emptyList' | oprL10n"></p>
</div>
{{$ctrl.externalInstructionsFiltered}}
{{$ctrl.selectedInstructions}}