假設我有一個組件,并且我有非可選的系結,就像這樣
angular.module("foo").component("fooComp", {
bindings: {
notOpt: "<",
},
templateUrl: "...",
controllerAs: "...",
controller: [fooCtrl],
});
function fooCtrl() {
const $vm = this;
$vm.$onInit = onInit;
function onInit() {
// ...
}
}
有沒有一種方法可以防止組件在沒有標志和 ngIf 的幫助下呈現?自毀之類的東西?
謝謝
uj5u.com熱心網友回復:
試試“條件渲染”:D 我離開了告訴你如何做的網站。React 和 Angular 都是 JavaScript。你可以用這個想法做你需要的事情:D
https://www.digitalocean.com/community/tutorials/7-ways-to-implement-conditional-rendering-in-react-applications
如果我的回答對你有幫助,請選擇我的回答:D
uj5u.com熱心網友回復:
我最終做的只是用 洗掉元素,$element.remove()然后用$scope.destroy().
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/420041.html
標籤:
上一篇:Druid連接SQL Server報錯:The TCP IP connection to the host 127.0.0.1, port 1433 has failed.
下一篇:如何實作類實體的惰性切片?
