在使用界面(html中)注冊:
@section scripts
{
<script type="text/javascript">
angular.module("app")
.factory("注冊的名稱",function () {
return {
ID: '@資源檔案名.ID',
};
})
</script>
}
在背景引用:
constructor(private注冊的名稱:any) {
使用:this.注冊的名稱.ID//調試時,可以看到“注冊的名稱”裡面包含所有界面return的所有字段
}
注意:“注冊的名稱”需唯一,并且是在使用界面注冊,也可以在母版頁中注冊。如果提示找不到或者未發現,一般為注冊的名字重複,或者引用方式錯誤