您好,登錄后才能下訂單哦!
課程信息管理界面有這樣一個(gè)需求,當(dāng)課程類型為公選課的時(shí)候,可以選擇課程性質(zhì),當(dāng)為其他課程類型的時(shí)候,不必選擇課程性質(zhì)。
代碼:
/** * 獲取課程類型下拉框數(shù)據(jù) */ getCourseTypeNameOptions(){ let url = "teachingManagement-web/course/queryAllCourseType"; this.http.get(url).subscribe( res =>{ this.courseTypeNameOptions = res.json().data; //如果是公共選修,可以選擇課程性質(zhì),如果不是,課程性質(zhì)為空 this.courseTypeNameOptions.forEach(item =>{ JSON.stringify(item); console.log(item); if(item.dictionaryName == "公共選修課"){ this.getCourseNatureNameOptions(); }else{ return; } }) } ); } /** * 課程類型為公共選修課,可選擇課程性質(zhì);其他類型,則不需選擇課程性質(zhì) * @param type */ changeType(type:string){ let dictionaryName=this.courseTypeNameOptions.find(x=>x.id==type).dictionaryName;//獲取的課程類型名稱 this.dictionaryName=dictionaryName; if(this.dictionaryName=="公共選修課"){ this.renderer2.removeAttribute(this.courseNature.nativeElement,"disabled"); }else{ this.courseInfo.courseNatureId=""; this.renderer2.setAttribute(this.courseNature.nativeElement,"disabled","disabled"); } }
總結(jié)
以上所述是小編給大家介紹的Angularjs按需查詢實(shí)例代碼,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)億速云網(wǎng)站的支持!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。