Giter VIP home page Giter VIP logo

sample-app-angular-hybrid's People

Contributors

boxmein avatar christopherthielen avatar dependabot-preview[bot] avatar elboman avatar greenkeeper[bot] avatar greenkeeperio-bot avatar vanhorickanthony avatar vucalur avatar wawyed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sample-app-angular-hybrid's Issues

App failed to start

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)

ngx-build-plus suggestion

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.

Example not following the documentation

At this line:

import uiRouter from "@uirouter/angularjs";

There is an import to "@uirouter/angularjs" but in the documentation it's written

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:
image

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!

Does it work for Angular 5+ ?

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 ?

No provider for UIView.PARENT_INJECT!

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.

Lazy loaded contacts module throws error in production build

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')

Client side code caching

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.

Angular states doesn't work

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"

screen shot 2017-08-31 at 17 33 48

Action required: Greenkeeper could not be activated 🚨

🚨 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.

Angular Hybrid App fails

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

No provider for UIRouter

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.

Why does sample app import from angularjs?

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!

Action required: Greenkeeper could not be activated 🚨

🚨 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.

sample app doesn't reflect all dependencies

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?

Transition Rejection -> $transitions.onError triggered all the time

hey,
When running sample app I get Transition Rejection a lot and as a result $transitions.onError triggered all the time. Steps to reproduce:

  1. npm install
  2. open requiresAuth.hook.ts -> add "$transitions.onError({}, (transition) => {console.log('error');})" (see screenshot on bottom)
  3. npm start
  4. click any button (messages/contacts/preferences)
  5. browser console:
  • Transition #0-0: Started -> "Transition#0( ''{} -> 'welcome'{} )"
  • trace.js:176 Transition #0-0: <- Success "Transition#0( ''{} -> 'welcome'{} )", final state: welcome
  • trace.js:170 Transition #1-0: <- Rejected "Transition#1( 'welcome'{} -> 'mymessages'{} )", reason: Transition Rejection($id: 0 type: 2, message: The transition has been superseded by a different transition, detail: 'login'{})
  • requiresAuth.hook.ts:30 error
  • trace.js:133 Transition #2-0: Started -> "Transition#2( 'welcome'{} -> 'login'{} )"
  • trace.js:176 Transition #2-0: <- Success "Transition#2( 'welcome'{} -> 'login'{} )", final state: login

Similar thing happens when refreshing page in the browser e.g.

  1. npm start
  2. click contacts
  3. login as first available user
  4. hit F5 or browser refresh button
  5. again, Transition Rejection and $transitions.onError is triggered.

angularhybridsampleapperror

Generally, just clicking through the pages or refreshing the page surely shouldn't cause rejections and triggering error handling?

Reduce app size

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.