Okta Callback not working


I am trying to use Okta with angular.
My redirect Uri is window.location.origin + ‘ui/login/callback’
My paths are defined as:
{ path: ‘ui/login’, component: LoginComponent },
{ path: ‘ui/login/callback’, component: OktaCallbackComponent},

The authorize endpoint is successful, but callback returns “code” and “state” but doesn’t display the app page. This works fine if I remove “ui/” from the redirect Uri and paths.
My Okta application is having ‘localhost:4200/ui/login/callback’ under “Login redirects”

Can someone help me here?