日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java中的module是什么意思_Angular - 组件中module.id的含义是什么?

發布時間:2023/12/2 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java中的module是什么意思_Angular - 组件中module.id的含义是什么? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Update for (2017-03-13) :

刪除了所有提及的moduleId . “組件相對路徑”cookbook已刪除我們在我們推薦的SystemJS配置中添加了一個新的SystemJS插件(systemjs-angular-loader.js) . 此插件動態地將templateUrl和styleUrls中的“組件相對”路徑轉換為“絕對路徑” . 我們強烈建議您只編寫組件相對路徑 . 這是這些文檔中討論的唯一URL形式 . 您不再需要編寫@Component({moduleId:module.id}),也不應該 .

Definition:

moduleId?: string

@Component 注釋中的 moduleId 參數采用 string 值,即;

“包含組件的模塊的模塊ID . ”

CommonJS用法: module.id ,

SystemJS用法: __moduleName

Reason to use moduleId :

moduleId 用于解析樣式表和模板的相對路徑,如文檔中所述 .

包含組件的模塊的模塊ID . 需要能夠解析模板和樣式的相對URL . 在Dart中,這可以自動確定,不需要設置 . 在CommonJS中,始終可以將其設置為module.id .

我們可以通過設置@Component元數據的moduleId屬性來指定模板和樣式文件相對于組件類文件的位置

Example usage:

文件夾結構:

RootFolder

├── index.html

├── config.js

├── app

│ ├── components

│ │ ├── my.component.ts

│ │ ├── my.component.css

│ │ ├── my.component.html

Without module.id :

@Component({

selector: 'my-component',

templateUrl: 'app/components/my.component.html',

styleUrls: ['app/components/my.component.css']

})

With module.id :

tsconfig.json:

{

"compilerOptions": {

"module": "commonjs",

...

@Component({

moduleId: module.id,

selector: 'my-component',

templateUrl: 'my.component.html',

styleUrls: ['my.component.css']

})

總結

以上是生活随笔為你收集整理的java中的module是什么意思_Angular - 组件中module.id的含义是什么?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。