Questions tagged [controller]

A controller is responsible for executing a sequence of instructions in response to some stimulus (maybe a command, action, or event). This is often used in conjunction with the Spring or model-view-controller tags.

A controller is responsible for executing a sequence of instructions in response to some stimulus (maybe a command, action, or event). It may be used to refer to the controller portion of the MVC (Model-View-Controller) pattern, or a general handler for actions and events that orchestrates a response. It may also refer to the Spring annotation @Controller.

As it can refer to a number of different things, this tag is best used in conjunction with other tags. So, if you're referring to the Spring @Controller annotation, use the Spring tag in conjunction with this one. If you're referring to the general MVC controller, use the model-view-controller tag.

16598 questions
49
votes
5 answers

Required_if laravel with multiple value

I have a dropdown menu like this: I want the following in…
48
votes
2 answers

How to call ApplicationController methods from ApplicationHelper

I want to provide csv links in a view and I placed the csv generating code in ApplicationHelper. However I'm getting this error: undefined method `send_data' for #<#:0x0000010151a070> referencing this: send_data content,…
David
  • 7,310
  • 6
  • 41
  • 63
48
votes
4 answers

How to test a Controller Concern in Rails 4

What is the best way to handle testing of concerns when used in Rails 4 controllers? Say I have a trivial concern Citations. module Citations extend ActiveSupport::Concern def citations ; end end The expected behavior under test is that any…
jelder
  • 2,220
  • 2
  • 19
  • 17
48
votes
3 answers

AngularJS - Directives vs Controllers

I am trying to create my first app using AngularJS. However, I'm a bit confused if I need to use directives for my particular case. I have a simple Map page, where I need to show lat/lon value of selected region. At the moment I'm not using…
mohi666
  • 6,842
  • 9
  • 45
  • 51
47
votes
2 answers

Default Routes in a Backbone.js controller?

I want to set a default route for my backbone.js controller. Currently I do it like so: class DealSearchController extends Backbone.Controller routes: 'list' : 'showListView' 'photos' : 'showPhotoView' 'map' :…
Martin Wawrusch
  • 790
  • 1
  • 6
  • 12
47
votes
4 answers

Angular JS resizable div directive

My site will have multiple sections, each of which I intend to be resizable. To accomplish this I've made a "resizable" directive, e.g.:
jayflo
  • 1,105
  • 1
  • 12
  • 21
46
votes
10 answers

SpringBoot 401 UnAuthorized even with out security

I did not use Spring Security but it is asking me to authenticate. Exception for URL(http://localhost:8080/SpringJob/ExecuteJob): { "timestamp": 1500622875056, "status": 401, "error": "Unauthorized", "message": "Bad credentials", …
sunleo
  • 10,589
  • 35
  • 116
  • 196
46
votes
3 answers

AngularJS: How to pass arguments/functions to a directive?

Look at this Fiddle, what do I have to change, that the expressions in the template get evaluated using the arguments I defined in the HTML? The SAVE-button should call the blabla()-function of the controller, since I pass it? var myApp =…
user1879408
  • 1,948
  • 3
  • 17
  • 27
45
votes
3 answers

How to set rate limit for each user in Spring Boot?

I am developing a Spring Boot Rest API which handles a lots of incoming request calls. My Controller is something like below: @RestController public class ApiController { List apiDataList; …
Ricky
  • 2,662
  • 5
  • 25
  • 57
45
votes
2 answers

Angularjs: a Service that serves multiple $resource urls / data sources?

I have an Angular service/provider that serves json data to my controller which works great: angular.module('myApp.services', ['ngResource']). factory("statesProvider", function($resource){ return $resource('../data/states.json', {},…
hzhu
  • 3,759
  • 5
  • 29
  • 39
45
votes
10 answers

AngularJs: controller is called twice by using $routeProvider

Module routes: var switchModule = angular.module('switchModule', []); switchModule.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/build-content', {templateUrl: 'build-content.html', controller:…
Howard
  • 4,474
  • 6
  • 29
  • 42
45
votes
9 answers

Check if in "dev" mode inside a Controller with Symfony

When using dev mode with a Symfony2.x application, one usually works in locale. Hence, such function does not works as expected (for instance, try to get the current IP under localhost). This could be a problem, e.g. when one try to use such…
JeanValjean
  • 17,172
  • 23
  • 113
  • 157
45
votes
9 answers

How can I run symfony 2 run command from controller

I'm wondering how can I run Symfony 2 command from browser query or from controller. Its because I don't have any possibility on hosting to run it and every cron jobs are setted by admin. I don't even have enabled exec() function so when I want to…
PayteR
  • 1,727
  • 1
  • 19
  • 35
43
votes
4 answers

One controller rendering using another controller's views

I have QuestionController I now have AnotherQuestionController with actions which should render using templates and partials in app/views/question/ Is this possible? Seems like it should be. I've tried render :template => "question/answer" but…
Paul
  • 1,021
  • 2
  • 12
  • 18
42
votes
1 answer

Exclude a controller from before_action

I am using the before_action filter to call authenticate which is a method that will redirect users back to their home page if they aren't authorized to be on the page requested. I would like to exclude a page from this step, just for testing…
Matt C
  • 4,470
  • 5
  • 26
  • 44