To do what you want, whenever the application starts you redirect the route to any screen, for this, do a state go in the run:
angular.module('myApp', [])
.config(something => {})
.run(function ($state) {
$state.go('rotaDaTelaComVideo');
});
According to Angular documentation: Documentation
config
is first called at module startup.
run
is called once at module startup, just after config.
Compilation of Directives and others...
Controllers are created.
Guidelines link, if any.
In this way, it is safe to call a route in the run, of meneira that in the next iteration of Angular it will load its module.
Bonus:
Still, if you want the video to run only once, you can save a flag on localStorage:
angular.module('myApp', [])
.config(something => {})
.run(function ($state, $window) {
if ($window.localStorage['alreadyShown'] !== true) {
$state.go('rotaDaTelaComVideo');
$window.localStorage['alreadyShown'] = true;
}
});
So it will run only the first time the user starts the application, or after clearing all the cache data.
Welcome to the stackoverlow community in English. Very good your answer :)
– Marco Giovanni