If I understand your issue, you don't want an action to be callable from
the browser directly and only within the context of your angular
application. Just throwing some general ideas out there. On the MCV side,
what about creating a custom action filter and checking for the Http
Referrer? If the referrer doesn't identify your angular application you
can issue a redirect response redirecting the user back to your
application? With a custom action filter on the MVC side you can apply it
to a specific action, controller, or globally. If you wanted to add
additional criteria you can always add custom Http headers of your own and
check for those in the filter as well, say an application guid.
This help?
Chris
On Monday, March 9, 2015 at 10:18:04 AM UTC-6, Nikola Radisic wrote:
>
> Hi.
>
>
> I am building a .NET MVC 5 application on back-end and Angularjs on
> front-end.
>
> I am loading .cshtml views in a div "containerOne" on a parent .cshtml
> page with ui.router and everything is working fine. An issue I would like
> to solve is when I enter manually a page URL that is C# controller's action
> path(in the example I provided below it is "/Proposal/Customers") - my view
> is loaded on a whole page. What I want to be called is a .state 'customers'
> in my example, or something like that. My example code is:
>
>
> - part of my proposalConfig.js:
>
>
> .state('customers', {
>
> url: 'AllCustomers',
>
> views: {
>
> "containerOne": {
>
> templateUrl: '/Proposal/Customers'
>
> }
>
> }
>
> });
>
>
> On my back-end I have a ProposalController.cs and an action method
> Customers that calls a Customers.cshtml view.
>
>
> Anyone has an idea how to solve this?
>
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.