Role based access in Angular JS Single Page Application - angularjs

I am working on an Angular JS Single Page Application with a Grails backend. I know, if I am using a GSP page, its easy to provide role based content using tags from the spring security plugin-
...
Is there anything like this provided out of the box in Angular?
Thanks in Advance.

Related

Custom login screen with Auth0 and AngularJS

Angular 2 has a custom login: https://auth0.com/docs/quickstart/spa/angular2/02-custom-login
But I can't find any for AngularJS, https://auth0.com/docs/quickstart/spa/angularjs
Is it not possible to have a custom login with AngularJS? Or do I need to manually use an API on the back-end?
It's possible to achieve the same functionality either by using Angular 1.X or Angular2. In this case, it's just a mismatch in the available sample code.
You would do this using the same Auth0 library, Auth0.js, that is being used in the Angular2 sample to achieve the custom login, so you can use that code as a baseline of what you need to do and adapt it from Angular2 to Angular 1.X or you can also check the documentation of the Auth0.js library itself; the section about single page apps would likely be the most useful.

AngularJS inside JSP page

I'm working on a project where all may work is jsp pages can i add AngularJS inside these pages , i'm also new to Angular
I work on a web project, which renders a lot of graphs and animation charts to end users. We have been using the AngularJS in the jsp for some time and this works fine for us. With jsp, one can easily determine the request context (for e.g the request context URI for another link) on the webpage. With AngularJS, we develop the json returning services on server side and process the data via angularJS directives.

Asp.Net MVC and AngularJS in same View

I´d like to know if exists a better way to render a view like this:
For the first load I need bring data from Controller like usual but after apply a filter in same page I need to start use AngularJS and never more uses Razor.
Is there a way to do that ?
Thanks for all.
Yes. you can do that.
Basically, you'd need to add the line below in your view. After you do that, the json is going to be available to the DOM / javascript and angular can take it from there. Hope this help
var json = '#Html.Raw(Model.MyJsonStringForMyCoolAngularJsApp)';
There are multiple ways to implement ASP.Net MVC with AngularJs.
I personally like Mini SPA (Silos). You can watch Miguel A Castro's video here.
You can also download the source at his website.
What it does is when a request comes in, it goes to ASP.Net MVC Route first. Then, Angular Route takes over the rest. It is a very slick design.
FYI: I also use Angular.Net Helpers to generate strongly typed views.
You could use WebAPI project in visual studio to exchange data between frontend and backend. It would go stateless, so to secure the data, you could use a mechanism like JWT.
The frontend would exchange JSONS from/to the backend using REST apis.
Yes. You can make angular views and exchange data using $http.get(/controller/method/). You can also configure routing using ngRoute.

Add drupal to exsisting Angular project

I got a angular project and I want to add drupal to it.
I want the admin to be able to add new content in drupal which will show in a feed on my page.
Is this possible?
Been trying to find a guide but it seems like I'm out of luck.
If you have the services module installed you can find all available REST calls under the services tab.
If you want for example fetching nodes you can fire a request to www.your-backend.org/api/node/.
Or consume data for a view with www.your-backend.org/api/views/view-name
To Integrate this in you Angular forntend you can use ng-drupal-7-services.
This Module provides nearly all possible API calls to drupal as well as a module to easily handle authentication to you backend.
It sets:
session data
cookie data
X-CSRF Token
At drupanionic.org you will fin demos for plain angular and ionic.
Instead of using drupal 7 you can download drupal 8 which is in beta and provides a restful api service "out of the box".

What is the recommended approach when using AngularJS with SharePoint WebParts

We have started using AngularJS within some SharePoint WebParts. So far, this has been working really well, however, we noticed that when we started placing more than one AngularJS WebPart onto a WebPart page, only the first WebPart on the page was bootstrapped by AngularJS. The second, or third, one simply didn't function. This is because we set up each WebPart as it's own Module/App in AngularJS. We were able to get around this using a technique described here:
Multiple apps and controllers in the same file
Is this a best practice for using AngularJS within SharePoint WebParts, or is there a better approach?
Steps:
1) Upload the angular JS files at top site collection level.
2) Refer angular JS files in master page.
3) Create a module in master page and refer the same in all the pages(Create separate controllers for each page).
4) Create a html page which has all the display which you want for the web part using angular JS.
5) Add a content editor web part on the page and refer that html page.

Resources