我正在使用谷歌地图自动填充和NgUIMap。当我在本地机器上运行时,它运行得非常好。在构建用于生产的角度2项目之后,它显示以下错误
请参阅详细信息错误信息,如下所示:
void CDeathMatch::RemoveViewer( CUser* pUser )
{
if( IsValidObj( pUser ) )
{
if( FindPlayer( pUser->m_idPlayer ) == 0 )
{
// First, you could use bool instead of BOOL as @mani66 suggested,
// however in this context the variable is unnecessary as
// the if statement can be eliminated
// Also, changed the postfix increment (i++) to a prefix
// increment (++i), as this eliminates the need for a
// temporary copy of i (this is what the postfix increment operator does)
for( size_t i = 0; i < m_vecDeathMatchViewer.size(); ++i )
{
if( m_vecDeathMatchViewer[i] == pUser->m_idPlayer )
{
// The contents of the if statement were placed here
m_vecDeathMatchViewer.erase(m_vecDeathMatchViewer.begin() + i );
break;
}
}
// If statement here was eliminated
}
}
}
下面给出了部分代码。
core.es5.js:1084 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'Autocomplete' of undefined
TypeError: Cannot read property 'Autocomplete' of undefined
at PlacesAutoComplete.initialize (places-auto-complete.js:17)
at SafeSubscriber._next (places-auto-complete.js:24)
at SafeSubscriber.__tryOrSetError (Subscriber.js:245)
at SafeSubscriber.next (Subscriber.js:187)
at Subscriber._next (Subscriber.js:125)
at Subscriber.next (Subscriber.js:89)
at FirstSubscriber._emitFinal (first.js:135)
at FirstSubscriber._emit (first.js:118)
at FirstSubscriber._next (first.js:97)
at FirstSubscriber.Subscriber.next (Subscriber.js:89)
at ReplaySubject.Array.concat.ReplaySubject._subscribe (ReplaySubject.js:55)
at ReplaySubject.Observable._trySubscribe (Observable.js:57)
at ReplaySubject.Subject._trySubscribe (Subject.js:97)
at ReplaySubject.Observable.subscribe (Observable.js:45)
at FirstOperator.call (first.js:70)
at PlacesAutoComplete.initialize (places-auto-complete.js:17)
at SafeSubscriber._next (places-auto-complete.js:24)
at SafeSubscriber.__tryOrSetError (Subscriber.js:245)
at SafeSubscriber.next (Subscriber.js:187)
at Subscriber._next (Subscriber.js:125)
at Subscriber.next (Subscriber.js:89)
at FirstSubscriber._emitFinal (first.js:135)
at FirstSubscriber._emit (first.js:118)
at FirstSubscriber._next (first.js:97)
at FirstSubscriber.Subscriber.next (Subscriber.js:89)
at ReplaySubject.Array.concat.ReplaySubject._subscribe (ReplaySubject.js:55)
at ReplaySubject.Observable._trySubscribe (Observable.js:57)
at ReplaySubject.Subject._trySubscribe (Subject.js:97)
at ReplaySubject.Observable.subscribe (Observable.js:45)
at FirstOperator.call (first.js:70)
at resolvePromise (zone.js:710) [angular]
at resolvePromise (zone.js:681) [angular]
at :8000/static/polyfills.bundle.js:3412:17 [angular]
at Object.onInvokeTask (core.es5.js:4140) [angular]
at drainMicroTaskQueue (zone.js:591) [<root>]
at HTMLAnchorElement.ZoneTask.invoke (zone.js:464) [<root>]
defaultErrorLogger @ core.es5.js:1084
ErrorHandler.handleError @ core.es5.js:1144
next @ core.es5.js:4778
schedulerFn @ core.es5.js:3851
SafeSubscriber.__tryOrUnsub @ Subscriber.js:236
SafeSubscriber.next @ Subscriber.js:185
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ core.es5.js:3837
NgZone.triggerError @ core.es5.js:4209
onHandleError @ core.es5.js:4170
ZoneDelegate.handleError @ zone.js:369
Zone.runGuarded @ zone.js:141
_loop_1 @ zone.js:602
drainMicroTaskQueue @ zone.js:611
ZoneTask.invoke @ zone.js:464
答案 0 :(得分:0)
使用ChangeDetectorRef
中的Constructor
服务,我们可以在视图模板中访问Viewchild
引用元素:
Constructor(private ref : ChangeDetectorRef){
}
//call detectChanges function before where to ViewChild element Native Element attribute
this.ref.detectChanges();