Questions tagged [controllers]

Controller provides a centralized entry point for handling requests. Usually is referred as a part of Model-View-Controller design pattern.

903 questions
276
votes
7 answers

Display a view from another controller in ASP.NET MVC

Is it possible to display a view from another controller? Say for example I have a CategoriesController and a Category/NotFound.aspx view. While in the CategoriesController, I can easly return View("NotFound"). Now say I have a ProductsController…
dtc
  • 10,136
  • 16
  • 78
  • 104
87
votes
3 answers

Angularjs, passing scope between routes

I have a situation with a form that stretches over several pages (might not be ideal, but that is how it is). I'd like to have one scope for the entire form that gets filled in as you go along, so that if the user goes back and forth between steps…
Erik Honn
  • 7,576
  • 5
  • 33
  • 42
68
votes
6 answers

accessing HttpContext.Request in a controller's constructor

I'm following this ASP.NET MVC tutorial from Microsoft: My code is slightly different, where I'm trying to access HttpContext.Request.IsAuthenticated in the controller's constructor. namespace SCE.Controllers.Application { public abstract class…
ozsenegal
  • 4,055
  • 12
  • 49
  • 64
49
votes
5 answers

How do I make global helper functions in laravel 5?

If I wanted to make a currentUser() function for some oauth stuff I am doing where I can use it in a view or in a controller (think rails, where you do helper_method: current_user in the application controller). Everything I read states to create a…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
44
votes
10 answers

How to pass model attributes from one Spring MVC controller to another controller?

I am redirecting from a controller to another controller. But I also need to pass model attributes to the second controller. I don't want to put the model in session. Please help.
ajm
  • 12,863
  • 58
  • 163
  • 234
30
votes
3 answers

How to split single controller in multiple js files in angularjs

I am rewriting a large application from silver-light to angularjs, while doing it, I am realizing that each of my controller js file is spanning 2000-3000 lines of code. All of my code is heavily dependent on scope variables. Wondering if there is…
Mothupally
  • 750
  • 2
  • 8
  • 16
27
votes
9 answers

AngularJS: lazy loading controllers and content

In this simplified scenario, I have two files: index.htm, lazy.htm. index.htm: var myApp = angular.module('myApp', []); myApp.controller('embed',function($scope){ $scope.embed = 'Embedded Controller'; });
26
votes
4 answers

What are the Laravel naming conventions for controllers/models/views?

I remember hearing you should name your controllers, models and views in a special way. Either singular or plural. I don't remember which ones to name what though, and i can't find anything about it in the doc. I'm guessing it's like…
qwerty
  • 5,166
  • 17
  • 56
  • 77
21
votes
1 answer

MVC ViewModel example

I've been doing tutorials and trying to learn best practice when it comes to MVC development. The design I'm using below comes from Pro ASP.Net MVC5 by Apress/Adam Freeman. So far, everything is coming along good...but I still have not completely…
JoshYates1980
  • 3,476
  • 2
  • 36
  • 57
19
votes
5 answers

angularjs multiple controllers on one page

I have a page with multiple controllers, one of the controller is being used in 2 different divs within the same page. I am not sure if it is a scope issue or I just miss something in my code. here is the plunkr…
Annie C
  • 764
  • 2
  • 12
  • 31
16
votes
1 answer

What are some scenario's of having a Session-less Controller in ASP.NET MVC3?

Reading Guru-Gu's blog post about ASP.NET MVC3 hitting RC, he says:- Session-less Controller Support You can now indicate whether you want a Controller class to use session-state – and if so whether you want it to be read/write or…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
16
votes
3 answers

What's the difference between controllers and actions in ruby on rails?

Can anybody tell me the difference between controllers and actions in ruby on rails? I fetched this definition from the official rails guide: A controller's purpose is to receive specific requests for the application. Routing decides which…
mobesa
  • 271
  • 3
  • 9
16
votes
7 answers

sails.js access controller method from controller method

How come in sails you cannot access other controller methods from within another one? like this. module.exports = findStore: -> # do somthing index: -> @findStore(); # Error: undefined Compiled module.exports = { findStore:…
iConnor
  • 19,997
  • 14
  • 62
  • 97
15
votes
4 answers

MVC 3 - Controllers and ViewModels - Which should contain most of the business logic?

Currently in my application and using the unit of work pattern and generic repository, all my controllers contain all of the business logic. I'm in the process of putting everything over to use ViewModels instead of the straight Model. While this is…
14
votes
8 answers

Retrieve salesforce instance URL instead of visualforce instance

From a visualforce page, I need to retrieve our organization's salesforce instance's URL, and not the visual force URL. For example I need https://cs1.salesforce.com instead of https://c.cs1.visual.force.com Here's what I've tried so far and the…
Jan Julian
  • 473
  • 2
  • 4
  • 15
1
2 3
60 61