Error: [$rootScope:inprog] - Forum

Forum Navigation
You need to log in to create posts and topics.

Error: [$rootScope:inprog]

Hola, a veces al probar mi aplicación me sale este error en la consola, y a veces no, cuando le meto "delay" me lo hace más frecuente. No se si hay algún problema o es normal? Pongo debajo el error y el código de mi neoapp lo que pretendo es hacer como una ruleta haciendo traer al frente imágenes. Un saludo y gracias por vuestro tiempo.

Error: [$rootScope:inprog] http://errors.angularjs.org/1.7.7/$rootScope/inprog?p0=$apply
at p (file:///C:/ProgramData/SinLios/VisualNeoWeb/js/angular.min.js:146:165)
at m.prototype.$apply (file:///C:/ProgramData/SinLios/VisualNeoWeb/js/angular.min.js:154:454)
at Anonymous function (file:///C:/ProgramData/SinLios/VisualNeoWeb/js/angular.min.js:118:48)
Error: [$rootScope:inprog] http://errors.angularjs.org/1.7.7/$rootScope/inprog?p0=$apply
at p (file:///C:/ProgramData/SinLios/VisualNeoWeb/js/angular.min.js:146:165)
at m.prototype.$digest (file:///C:/ProgramData/SinLios/VisualNeoWeb/js/angular.min.js:151:46)
at m.prototype.$apply (file:///C:/ProgramData/SinLios/VisualNeoWeb/js/angular.min.js:155:33)
at Anonymous function (file:///C:/ProgramData/SinLios/VisualNeoWeb/js/angular.min.js:118:48)
[$rootScope:inprog] http://errors.angularjs.org/1.7.7/$rootScope/inprog?p0=$apply (angular.min.js, 155)

 

<?xml version="1.0" encoding="utf-8"?>
<Application>
<AppTitle>Aplicación sin título</AppTitle>
<DesignDeviceName>Samsung Galaxy Tab 10</DesignDeviceName>
<VariablesScanned>False</VariablesScanned>
<PageWidth>1280</PageWidth>
<PageHeight>800</PageHeight>
<AutoSizeWidth>False</AutoSizeWidth>
<AutoSizeHeight>False</AutoSizeHeight>
<HideScrollbars>False</HideScrollbars>
<PublishPlatform>WinEXE</PublishPlatform>
<EmptyBuildFolder>False</EmptyBuildFolder>
<LanguageCode>es</LanguageCode>
<MinifySource>True</MinifySource>
<MobileOSTypes>[AndroidOS,iOS,WindowsPhoneOS]</MobileOSTypes>
<WindowState>normal</WindowState>
<TitleBar>True</TitleBar>
<Sizeable>True</Sizeable>
<MaximizeBtn>False</MaximizeBtn>
<MinimizeBtn>True</MinimizeBtn>
<SystemMenu>True</SystemMenu>
<ContextMenu>False</ContextMenu>
<AlwaysOnTop>False</AlwaysOnTop>
<ShowInTaskbar>True</ShowInTaskbar>
<SingleInstance>False</SingleInstance>
<ChromeKioskMode>False</ChromeKioskMode>
<Components>
<FunctionList name="Subroutines"/>
<LibraryList name="Libraries"/>
<PageList name="Main">
<Components>
<Page id="NewPage">
<Components>
<Image id="Image10">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen10.jpg</source>
</Image>
<Image id="Image9">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen9.jpg</source>
</Image>
<Image id="Image8">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen8.jpg</source>
</Image>
<Image id="Image7">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen7.jpg</source>
</Image>
<Image id="Image6">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen6.jpg</source>
</Image>
<Image id="Image5">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen5.jpg</source>
</Image>
<Image id="Image4">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen4.jpg</source>
</Image>
<Image id="Image3">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen3.jpg</source>
</Image>
<Image id="Image2">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen2.jpg</source>
</Image>
<Image id="Image1">
<left>297px</left>
<top>168px</top>
<width>266px</width>
<height>265px</height>
<source>imagen1.jpg</source>
</Image>
<PushButton id="PushButton1">
<left>74px</left>
<top>173px</top>
<width>134px</width>
<height>99px</height>
<click>Loop 1 10 [lop]
ObjectToFront &quot;Image[lop]&quot;
Delay 20
endloop
Loop 1 10 [lop]
ObjectToFront &quot;Image[lop]&quot;
Delay 20
endloop
Loop 1 10 [lop]
ObjectToFront &quot;Image[lop]&quot;
Delay 20
endloop</click>
</PushButton>
<Headline id="Headline1">
<left>238px</left>
<top>117px</top>
<width>189px</width>
<height>138px</height>
<text>[lop]</text>
</Headline>
</Components>
</Page>
</Components>
</PageList>
<PageList name="Master">
<Components>
<Page id="MasterPage"/>
</Components>
</PageList>
<PageList name="Dialog">
<Components>
<Page id="NewDialog">
<Components>
<DialogContainer id="DialogContainer1">
<left>0px</left>
<top>0px</top>
<width>1280px</width>
<height>800px</height>
<close_button>False</close_button>
</DialogContainer>
</Components>
</Page>
</Components>
</PageList>
</Components>
</Application>

 

Hola @jlash,

Me temo que no es buena idea utilizar el comando Delay dentro de un loop.
En JavaScript no es posible detener la ejecución de un script y aunque Dave en su día proporcionó un método para hacerlo (personalmente no me gusta), solo es confiable en situaciones sencillas, no dentro de un loop.

Es mucho mejor utlizar Wait...EndWait en su lugar o incluso SetTimeOut.
Se que es un poco más complicado así, pero es la manera correcta de hacerlo ya que culaquier otro sistema bloqueará la interfaz de usuario.
No obstante, si aun con los mensajes de error tu aplicación funciona, puedes dejarlo como está.

Un saludo.

Ok, gracias, lo intento con Wait