ui-router / sample-app-angular-hybrid Goto Github PK
View Code? Open in Web Editor NEWUI-Router Hybrid Sample App: Route to Angular 1 and Angular 2 components
Home Page: https://ui-router.github.io/sample-app-angular-hybrid
UI-Router Hybrid Sample App: Route to Angular 1 and Angular 2 components
Home Page: https://ui-router.github.io/sample-app-angular-hybrid
console:
Probably similar issue to this one:
angular-ui/ui-router#3555
Hi,
Why sample app was downgraded to Angular 4? Does angular-hybrid UIRouter AoT compilation and lazy loading work for Angular 5 and AngularCompilerPlugin instead of AotPlugin ?
ERROR NullInjectorError: StaticInjectorError(AppModule)[UISref -> UIRouter]:
StaticInjectorError(Platform: core)[UISref -> UIRouter]:
NullInjectorError: No provider for UIRouter!
at NullInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:36417:27)
at resolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51335:24)
at tryResolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51261:16)
at StaticInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:51111:20)
at resolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51335:24)
at tryResolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51261:16)
at StaticInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:51111:20)
at resolveNgModuleDep (https://localhost:3000/cmep/lib/vendor-es2015.js:62298:29)
at NgModuleRef_.get (https://localhost:3000/cmep/lib/vendor-es2015.js:63364:16)
at resolveDep (https://localhost:3000/cmep/lib/vendor-es2015.js:63895:45)
View_AppComponent_0 @ AppComponent.html:2
proxyClass @ compiler.js:19671
logError @ core.js:45546
handleError @ core.js:6066
(anonymous) @ core.js:40731
invoke @ zone-evergreen.js:359
run @ zone-evergreen.js:124
runOutsideAngular @ core.js:39572
(anonymous) @ core.js:40728
invoke @ zone-evergreen.js:359
onInvoke @ core.js:39699
invoke @ zone-evergreen.js:358
run @ zone-evergreen.js:124
(anonymous) @ zone-evergreen.js:855
invokeTask @ zone-evergreen.js:391
onInvokeTask @ core.js:39680
invokeTask @ zone-evergreen.js:390
runTask @ zone-evergreen.js:168
drainMicroTaskQueue @ zone-evergreen.js:559
invokeTask @ zone-evergreen.js:469
invokeTask @ zone-evergreen.js:1603
globalZoneAwareCallback @ zone-evergreen.js:1640
AppComponent.html:2 ERROR CONTEXT DebugContext_ {view: {…}, nodeIndex: 4, nodeDef: {…}, elDef: {…}, elView: {…}}
View_AppComponent_0 @ AppComponent.html:2
proxyClass @ compiler.js:19671
logError @ core.js:45546
handleError @ core.js:6071
(anonymous) @ core.js:40731
invoke @ zone-evergreen.js:359
run @ zone-evergreen.js:124
runOutsideAngular @ core.js:39572
(anonymous) @ core.js:40728
invoke @ zone-evergreen.js:359
onInvoke @ core.js:39699
invoke @ zone-evergreen.js:358
run @ zone-evergreen.js:124
(anonymous) @ zone-evergreen.js:855
invokeTask @ zone-evergreen.js:391
onInvokeTask @ core.js:39680
invokeTask @ zone-evergreen.js:390
runTask @ zone-evergreen.js:168
drainMicroTaskQueue @ zone-evergreen.js:559
invokeTask @ zone-evergreen.js:469
invokeTask @ zone-evergreen.js:1603
globalZoneAwareCallback @ zone-evergreen.js:1640
zone-evergreen.js:651 Unhandled Promise rejection: StaticInjectorError(AppModule)[UISref -> UIRouter]:
StaticInjectorError(Platform: core)[UISref -> UIRouter]:
NullInjectorError: No provider for UIRouter! ; Zone: ; Task: Promise.then ; Value: NullInjectorError: StaticInjectorError(AppModule)[UISref -> UIRouter]:
StaticInjectorError(Platform: core)[UISref -> UIRouter]:
NullInjectorError: No provider for UIRouter!
at NullInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:36417:27)
at resolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51335:24)
at tryResolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51261:16)
at StaticInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:51111:20)
at resolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51335:24)
at tryResolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51261:16)
at StaticInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:51111:20)
at resolveNgModuleDep (https://localhost:3000/cmep/lib/vendor-es2015.js:62298:29)
at NgModuleRef_.get (https://localhost:3000/cmep/lib/vendor-es2015.js:63364:16)
at resolveDep (https://localhost:3000/cmep/lib/vendor-es2015.js:63895:45) NullInjectorError: StaticInjectorError(AppModule)[UISref -> UIRouter]:
StaticInjectorError(Platform: core)[UISref -> UIRouter]:
NullInjectorError: No provider for UIRouter!
at NullInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:36417:27)
at resolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51335:24)
at tryResolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51261:16)
at StaticInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:51111:20)
at resolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51335:24)
at tryResolveToken (https://localhost:3000/cmep/lib/vendor-es2015.js:51261:16)
at StaticInjector.get (https://localhost:3000/cmep/lib/vendor-es2015.js:51111:20)
at resolveNgModuleDep (https://localhost:3000/cmep/lib/vendor-es2015.js:62298:29)
at NgModuleRef_.get (https://localhost:3000/cmep/lib/vendor-es2015.js:63364:16)
at resolveDep (https://localhost:3000/cmep/lib/vendor-es2015.js:63895:45)
api.onUnhandledError @ zone-evergreen.js:651
handleUnhandledRejection @ zone-evergreen.js:675
api.microtaskDrainDone @ zone-evergreen.js:668
drainMicroTaskQueue @ zone-evergreen.js:566
invokeTask @ zone-evergreen.js:469
invokeTask @ zone-evergreen.js:1603
globalZoneAwareCallback @ zone-evergreen.js:1640
Add support for Angular V17, as required in ui-router/angular-hybrid#594.
After a clean clone, npm install
and npm start
I'm seeing the visualiser (and can click states) but the following error appears in the console:
zone.js:654 Unhandled Promise rejection: No provider for UIRouter! ; Zone: <root> ; Task: Promise.then ; Value: Error: No provider for UIRouter!
at injectionError (core.es5.js:1169)
at noProviderError (core.es5.js:1207)
at ReflectiveInjector_._throwOrNull (core.es5.js:2649)
at ReflectiveInjector_._getByKeyDefault (core.es5.js:2688)
at ReflectiveInjector_._getByKey (core.es5.js:2620)
at ReflectiveInjector_.get (core.es5.js:2489)
at resolveNgModuleDep (core.es5.js:9475)
at NgModuleRef_.get (core.es5.js:10557)
at main.ts:51
at ZoneDelegate.invoke (zone.js:391) Error: No provider for UIRouter!
at injectionError (http://localhost:8080/_bundles/vendor.bundle.js:1592:90)
at noProviderError (http://localhost:8080/_bundles/vendor.bundle.js:1630:12)
at ReflectiveInjector_._throwOrNull (http://localhost:8080/_bundles/vendor.bundle.js:3072:19)
at ReflectiveInjector_._getByKeyDefault (http://localhost:8080/_bundles/vendor.bundle.js:3111:25)
at ReflectiveInjector_._getByKey (http://localhost:8080/_bundles/vendor.bundle.js:3043:25)
at ReflectiveInjector_.get (http://localhost:8080/_bundles/vendor.bundle.js:2912:21)
at resolveNgModuleDep (http://localhost:8080/_bundles/vendor.bundle.js:9898:25)
at NgModuleRef_.get (http://localhost:8080/_bundles/vendor.bundle.js:10980:16)
at http://localhost:8080/_bundles/sampleapp.js:6762:24
at ZoneDelegate.invoke (http://localhost:8080/_bundles/vendor.bundle.js:58515:26)
It seems this is occurring in this line:
const url: UrlService = injector.get(UIRouter).urlService
And is therefore preventing it from calling url.listen(); url.sync();
and is causing it to show a blank page (apart from the visualizer).
Any ideas what might be wrong? This is happening in a personal project of mine as well.
Hi Chris,
As I have gotten closer to Angular CLI, it is evident that this is the best way to manage an Angular project's build. Of course a hybrid project has additional challenges. There is this new project, ngx-build-plus and I am playing with it. Bottom line is, updating this project to use ngx-build-plus, overwriting just the angular.js specific webpack stuff (externals, etc) would lead to a better product. The whole point is to move on to Angular, and the best part of Angular is Angular CLI. For the moment, ngx-build-plus lets you use Angular cli with minor tweaks and lets the rest of the build chain (AOT, etc) all conform to Angular CLI.
Cloned the project, and installed the dependencies, but /contacts
and /prefs
state are not resolved, and the user is redirected to /welcome
. Even the visualizer doesn't show the contacts and prefs state.
package.json
"@uirouter/angular-hybrid": "^3.1.4"
"angular": "^1.6.6"
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@angular/upgrade": "^4.0.0"
the error is:
Unhandled Promise rejection: (SystemJS) $view.viewConfigFactory is not a function
I am interested in using the prefs (feature module) example, which imports:
import { UIRouterModule } from "@uirouter/angular";
but package.json doesn't depend on that. How is it pulled in? Does this work with Angular 5 or is it locked to 4.0.0?
git clone
npm install
npm build
Open browser and attempt to navigate to the contacts state. The lazy loaded JS bundle is requested and completes loading and the following error is produced on the console:
Transition Rejection($id: 1 type: 6, message: The transition errored, detail: Error: Cannot find 'ContactsModule' in './contacts/contacts.module')
At this line:
Remove angular-ui-router (or @uirouter/angularjs) from your AngularJS app's package.json and replace it with @uirouter/angular-hybrid. Add the @angular/* dependencies.
Therefore what should I do?
If I remove it from the app's package.json, I cannot import it otherwise I got a compilation error. However, in the live example, I noticed that the @uirouter/angularjs lib has been loaded by Webpack.
I'm asking this question because I kept it in the package.json then removed it and my app doesn't run anymore (I'm using SystemJS) because I get an error in Chrome:
Sould I keep it and reference it using some specific path (like this one: "@uirouter/angular-hybrid/node_modules/@uirouter/angularjs") which works btw?
Thanks!
Related to ui-router/angular-hybrid#589
Update this app to reference Angular 16
Got latest version.
npm install
npm start
See error:
Trying to get the AngularJS injector before it being set. ; Zone: ; Task: Promise.then ; Value: Error: Trying to get the AngularJS injector before it being set.
Unable to use
Hi,
My AngularJS app does not use typescript. Possible to provide an example of AngularJS on javascript and Angular2+ using this library?
It doesn't look like the angular states are getting into the state registry when used in combination with @uirouter/angular 6.0.2.
To reproduce, update package.json with @uirouter/angular 6.0.2.
Note that contacts and preferences buttons do not update the state.
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
hey,
When running sample app I get Transition Rejection a lot and as a result $transitions.onError triggered all the time. Steps to reproduce:
Similar thing happens when refreshing page in the browser e.g.
Generally, just clicking through the pages or refreshing the page surely shouldn't cause rejections and triggering error handling?
My understanding is that you should not be installing uirouter/angularjs for a hybrid app. All you need is the uirouter/angular-hybrid?
from sample app:
import uiRouter from uirouter/angularjs;
I followed the sample app when converting my app to a hybrid and it worked great. I am also using webpack. Later when I was doing some cleanup, I deleted what I thought were no longer needed folders (like the @uirouter/angularjs
). When I saw this build error I changed it to pull from @uirouter/core
. Is that correct?
When I made this change, my app would no longer work. It looks like my vendor bundle is dramatically different after this change and I think something that was being included before is no longer being included (sorry for lack of details). When I switched back to @uirouter/angularjs everything works again, but I'm assuming this will probably cause me problems later?
Is the sample app right? If so, isn't it conflicting with the documentation?
I've used ui-router forever in angular 1.x apps and LOVE it. I'm hoping to continue using it for the hybrid apps we have. Thanks!
current dual boot app size is big, which mainly become heavy in case of mobile app for downloading. Dual boot app size is near about 36MB which is 6MB on live which was build only with angularjs.
We tried to use ng build --prod to reduce size of the app, it reduced the size but app is not working after deployment. It gives Header Overflow error.
Run "npm run start" then get the following error
Uncaught TypeError: ui_router_ng2_1.UIRouterRx is not a constructor
at eval (ng1-to-ng2.js:259)
at Object.invoke (angular.js:4842)
at eval (angular.js:4645)
at forEach (angular.js:357)
at createInjector (angular.js:4645)
at doBootstrap (angular.js:1838)
at Object.angular.resumeBootstrap (angular.js:1867)
at Object.windowAngular.resumeBootstrap (upgrade.umd.js:992)
at maybeBootstrap (hint.js:569)
at ZoneDelegate.invokeTask (zone.js:265)
Hi
I am trying to run custome-webpack hybrid app, It is working fine on chrome but when I am trying to launch in IE11 it gives in syntax error.
I have tried with the polyfills but nothing worked for me.
Can you please take a look and please let me know if angular-hybrid won't work in IE11.
Sample app - https://github.com/ui-router/sample-app-angular-hybrid/tree/custom-webpack-config
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
how to avoid caching of js, css, image files which are mentioned in angular.json & in components. Basically we want to know how to handle caching or is there any way by which angular handles it on its own.
Hello,
I am trying to port my angular 1.5 application to angular 2.
In the app i use angular-ui-router, so doring the upgrade process i want to upgrade the ui router too.
I try to mirror the process from this repo, since it provides a realy good example.
However when i try to use ng1-to-ng2 in my app, it throws "No provider for UIView.PARENT_INJECT!" error.
I was searching in the sapmple app where you register the providers, but i couldn't find it. I know its not an issue with the repo, but i dont know here else i could get help.
My code snippets:
app.ts
import uiRouter from 'angular-ui-router';
....
const appDependencies = [
uiRouter,
'ui.router.upgrade', ..... ]
....
angular.module(name, appDependencies)
main.ts
import { uiRouterNgUpgrade } from 'ui-router-ng1-to-ng2';
uiRouterNgUpgrade.setUpgradeAdapter(upgradeAdapter);
myComponent.ts
import { UIROUTER_DIRECTIVES } from 'ui-router-ng2';
@Component({
...
directives: [UIROUTER_DIRECTIVES],
...
constructor(@Optional() @Inject(UIView.PARENT_INJECT) view,) {
this.state = view && view.context && view.context.name;
}
These snipets are the same as in the sample app. However the sample app runs without error while my app crashes. I tried importing UIROUTER_PROVIDERS but with using that, it throw an error No provider for UIRouterConfig.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.