How to load modules in Angular Electron? - angularjs

I have a functioning angular electron application which was made using this boilerplate code:
https://github.com/maximegris/angular-electron
I am trying to add the ngSanitize module (https://docs.angularjs.org/api/ngSanitize) to my application and I'm stuck at "loading the module in your application by adding it as a dependent module":
angular.module('app', ['ngSanitize']);
How can I do this in an angular electron application with the current file setup? Thank you!

Like you can read on electron's website it uses Angular v2+ (currently 6.1.2). And you are trying write in AngularJS.
For the beginning here is something about modules: https://angular.io/guide/ngmodules but I would suggest you get familiar with whole tutorial and new version of Angular

Related

Need help bootstrapping an AngularJS app into an Angular2 CLI generated app using ngUpgrade

I've been wrestling with this for almost a day now, so I think it's time I give up and ask for help.
I started with a trivial AngularJS application (1.4.7) that should simply display "Greetings from Angular 1", and have been trying to bootstrap that application into a trivial Angular2 CLI generated app.
It doesn't seem to work. Instead of "Greetings from Angular 1", I see "{{angular1Msg}}". The following commit shows exactly what I did to include and bootstrap the app. I've spent quite a bit of time now with the documentation and am not sure what I'm missing.
Any help would be greatly appreciated!
Project repo:
https://github.com/scottschafer/ng2hybrid
The commit in which I attempted to integrate the AngularJS app:
https://github.com/scottschafer/ng2hybrid/commit/4b2c7c5339388ec2b3debeae0643dff89b75926f
(note that the source for the AngularJS app lives in src/ng1app, and is a working standalone AngularJS 1.4.7 application).
I finally got this working. A lot of trial and error. Not much fun at all.
https://github.com/scottschafer/ng2hybrid

Angularjs Ui-scrollpoint issue

var app = angular.module('app', ['ui-scrollpoint,'ngRoute','ui.bootstrap','ngSanitize']);
Im working with angularjs .I want to use scrollpoint in my angularjs application .But always im getting error and my module doesnot get loaded.What is the issue with this. Can anyone help me giving the required cdn for ui-scrollpoint?
You can take it directly from the GitHub, where it's repository is hosted:
https://rawgit.com/angular-ui/ui-scrollpoint/master/dist/scrollpoint.js
Also, https://cdn.jsdelivr.net/npm/angular-ui-scrollpoint#2.1.1/dist/scrollpoint.min.js

Angularjs with liferay

I am trying to use angular Js with liferay 6.2. But I am getting error in injecting controller. Same code works well in spring web app. Angular js not compatible with liferay?
Error : [injector: unpr] http://errors.angularjs.org/1.4.9
It looks like you forgot to load the module.

Use AngularJS (Angular1) module from Angular2 project

Just started a demo Angular2 project (no previous experience with Angular1/AngularJS. Have followed and extended from the online quickstart and tutorials, and all was fine. However I'm at the point where I would like to use some components from a library which is designed for AngularJS, and having no end of problems!
Most of the information available about AngularJS/Angular2 compatibility assumes that you have an AngularJS project that you're adding Angular2 components to - not the other way around - so what I'm hoping to do may not even be possible. What I've tried so far involves a simple stripped-back project based on the Angular2 quickstart, with a single Angular2 component that loads into the index.html. I'd then like to integrate components from the existing library (AngularJS-based) into this.
I've tried using UpgradeAdapter.upgradeNg1Component to create components from the library and add them directly into my Angular2 component
I've tried installing angularjs through npm, importing it in a script tag into my index.html and then using a combination of UpgradeAdapter.downgradeNg2Component and UpgradeAdapter.bootstrap to load my Angular2 as a downgraded module
Neither of these seem to work - the component fails to show, and the browser console tells me I've got an Uncaught SyntaxError: Unexpected token <
Evaluating http://localhost:3000/angular2/upgrade
Error loading http://localhost:3000/app/main.js
My best guess at the moment is that this is actually an unsupported scenario, and I need to have a 'proper' AngularJS app in order to use the UpgradeAdapter functionality from Angular2. Can anyone confirm this? Or is there something stupid I'm missing here?
Here is a working plunkr describing how to mix Angular1 and Angular2 elements:
http://plnkr.co/edit/yMjghOFhFWuY8G1fVIEg?p=preview
An important point is to bootstrap your main component on the UpgradeAdapter. This way all elements are available in providers (services / factories) and in directives (components / directives):
upgrade.bootstrap(document.body, ['heroApp']);
These two answers could help you:
angular 1.x and angular2 together
How to inject upgraded Angular 1 service/factory to Angular 2 component in ES5?
So the major problem in this case turned out to be the fact that it appears that the upgrade components aren't included as part of the basic angular 2 bundle. After adding:
<script src="node_modules/angular2/bundles/upgrade.min.js"></script>
to my index.html file the error I was seeing disappeared.
Thanks to the answer here for pointing me in the right direction!

AuthService with AngularJS not work

Hi friends i am new with angular js.
i try to create login and register with angular js.
i used this tutorials for authentication.Click here
i got this error i don't know why i think i forgot to include any authentication js file.
please how to resolve this error.
i think you are using $routeProvider for your angular app. but in your example angular app is using $stateProvider.so you have to install angular-ui-router.js and give reference to it to the index.html .
and also you have to put dependency 'ui.router' in to app.js
Stop the Javascript based authentication and opt for a token based approach using server-side language like PHP coupled with AJAX.

Resources