据我所知,我可以指定本地模板变量来保存元素引用,如下面的
<input #myInput />
但是我可以用自定义值声明变量吗?
例如:
<!-- Somewhere I do #obj = model.data.something -->
<input [(ngModel)]="obj.inputA" >
<input [(ngModel)]="obj.inputB" >
而不是做
<input [(ngModel)]="model.data.something.inputA" >
<input [(ngModel)]="model.data.something.inputB" >
答案 0 :(得分:2)
您无法使用自定义值声明变量。
模板变量
LINK : error LNK2001: unresolved external symbol _Ptrace_DllMainCRTStartup
inscount0.obj : error LNK2019: unresolved external symbol "public: void __cdecl LEVEL_BASE::MESSAGE_TYPE::MessageNoReturn(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool,enum PIN_ERRTYPE,int,...)" (?MessageNoReturn@MESSAGE_TYPE@LEVEL_BASE@@QAAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_NW4PIN_ERRTYPE@@HZZ) referenced in function "void __cdecl printip(unsigned int,void *,char *)" (?printip@@YAXIPAXPAD@Z)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::AssertString(char const *,char const *,unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?AssertString@LEVEL_BASE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD0IABV23@@Z) referenced in function "void __cdecl printip(unsigned int,void *,char *)" (?printip@@YAXIPAXPAD@Z)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::StringDec(unsigned __int64,unsigned int,char)" (?StringDec@LEVEL_BASE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_KID@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::decstr(unsigned int,unsigned int)" (?decstr@LEVEL_BASE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@II@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: __thiscall LEVEL_BASE::KNOB_BASE::KNOB_BASE(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,enum LEVEL_BASE::KNOB_MODE)" (??0KNOB_BASE@LEVEL_BASE@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0000W4KNOB_MODE@1@@Z) referenced in function "public: __thiscall LEVEL_BASE::KNOB<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::KNOB<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(enum LEVEL_BASE::KNOB_MODE,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$KNOB@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@QAE@W4KNOB_MODE@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@1111@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::KNOB_BASE::StringKnobSummary(void)" (?StringKnobSummary@KNOB_BASE@LEVEL_BASE@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "int __cdecl Usage(void)" (?Usage@@YAHXZ)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_CORE::INS_Disassemble(class LEVEL_CORE::INDEX<6>)" (?INS_Disassemble@LEVEL_CORE@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$INDEX@$05@1@@Z) referenced in function "void __cdecl Instruction(class LEVEL_CORE::INDEX<6>,void *)" (?Instruction@@YAXV?$INDEX@$05@LEVEL_CORE@@PAX@Z)
inscount0.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl LEVEL_PINCLIENT::RTN_Name(class LEVEL_CORE::INDEX<3>)" (?RTN_Name@LEVEL_PINCLIENT@@YAABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$INDEX@$02@LEVEL_CORE@@@Z) referenced in function "void __cdecl FlagRtn(class LEVEL_CORE::INDEX<3>,void *)" (?FlagRtn@@YAXV?$INDEX@$02@LEVEL_CORE@@PAX@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static unsigned __int64 __cdecl LEVEL_BASE::KNOBVALUE<unsigned __int64>::FromString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?FromString@?$KNOBVALUE@_K@LEVEL_BASE@@SA_KABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: void __thiscall LEVEL_BASE::KNOBVALUE<unsigned __int64>::Accumulate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Accumulate@?$KNOBVALUE@_K@LEVEL_BASE@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl LEVEL_BASE::KNOBVALUE<unsigned __int64>::Type(void)" (?Type@?$KNOBVALUE@_K@LEVEL_BASE@@SA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __thiscall LEVEL_BASE::KNOB<unsigned __int64>::Type(void)" (?Type@?$KNOB@_K@LEVEL_BASE@@UAE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
inscount0.obj : error LNK2019: unresolved external symbol "public: static __int64 __cdecl LEVEL_BASE::KNOBVALUE<__int64>::FromString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?FromString@?$KNOBVALUE@_J@LEVEL_BASE@@SA_JABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: void __thiscall LEVEL_BASE::KNOBVALUE<__int64>::Accumulate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Accumulate@?$KNOBVALUE@_J@LEVEL_BASE@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl LEVEL_BASE::KNOBVALUE<__int64>::Type(void)" (?Type@?$KNOBVALUE@_J@LEVEL_BASE@@SA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __thiscall LEVEL_BASE::KNOB<__int64>::Type(void)" (?Type@?$KNOB@_J@LEVEL_BASE@@UAE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl LEVEL_BASE::KNOBVALUE<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::FromString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?FromString@?$KNOBVALUE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@SA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z) referenced in function "public: void __thiscall LEVEL_BASE::KNOBVALUE<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Accumulate(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Accumulate@?$KNOBVALUE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
inscount0.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __cdecl LEVEL_BASE::KNOBVALUE<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Type(void)" (?Type@?$KNOBVALUE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@SA?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __thiscall LEVEL_BASE::KNOB<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Type(void)" (?Type@?$KNOB@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@LEVEL_BASE@@UAE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
pin.lib(reg.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(cfg_ia32.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(ipc_common_windows.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(ipc_connection_windows.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(modules_win.obj) : error LNK2001: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z)
pin.lib(elf_windows.obj) : error LNK2019: unresolved external symbol "public: static void * __cdecl std::__malloc_alloc::allocate(unsigned int)" (?allocate@__malloc_alloc@std@@SAPAXI@Z) referenced in function "class LEVEL_CORE::INDEX<21> __cdecl LEVEL_CORE::FindLinkerDefinedSymbol(class std::basic_string<char,class std::char_traits<char>,class std::allocator<char> > const &)" (?FindLinkerDefinedSymbol@LEVEL_CORE@@YA?AV?$INDEX@$0BF@@1@ABV?$basic_string@DV?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
属性exportAs: 'xxx'
#myVar="xxx"
还有一个未解决的问题,即支持分配自定义表达式https://github.com/angular/angular/issues/2451