controller

How to Delete controller ExtJS?

不想你离开。 提交于 2019-12-21 04:48:06
问题 I dynamically create controllers in my application like this: var loadedController = me.app.getController(controller_name); loadedController.init(); How can I delete this controller after using? Thanks. 回答1: ExtJs currently does not support removal of controllers out of the box. To cleanup a controller, do the following: Extend Ext.app.EventBus with a method uncontrol that unregisters all event listeners that this controller registered on the EventBus. Check out the source of Ext.app.EventBus

yii2 change controller action in gridview

a 夏天 提交于 2019-12-21 04:46:20
问题 I have ItemController and in actionView I put gridview of my Itempicture, and I want when I click on icon view, update and delete then go to ItempictureController. so How to change controller action in gridview with different controller? 回答1: You need to set $controller property of yii\grid\ActionColumn. In your case, try this: [ 'class' => 'yii\grid\ActionColumn', 'controller' => 'itempicture' ] http://www.yiiframework.com/doc-2.0/yii-grid-actioncolumn.html#$controller-detail If you are

How can I test an event of a MVC controller

陌路散爱 提交于 2019-12-21 04:42:40
问题 I want to test the OnException , OnActionExecuted event of an MVC controller. If I use mock like this: var httpContext = MockRepository.GenerateMock<HttpContextBase>(); var request = MockRepository.GenerateMock<HttpRequestBase>(); httpContext.Expect(c => c.Request).Return(request).Repeat.AtLeastOnce(); request.Expect(r => r.IsAuthenticated ).Return(true).Repeat.AtLeastOnce(); var controller = new MyController() ; controller.ControllerContext = new ControllerContext(httpContext, new RouteData(

Reload AngularJS Controller

假如想象 提交于 2019-12-21 03:30:55
问题 I'm a newbie to angularjs. My problem is that I have a User Controller for handling Login and Logout. I have also another controller to load a header menu for my site. If the user logs in to the site my isAuthenticated variable is set to true. If the variable is set to true the header should be change but, so I think the controller must be reloaded to change the header view. Here the code of my HeaderController: myapp.controller('HeaderController', ['$scope', '$location', '$window',

Launching a login view before the tab bar controller is displayed

我们两清 提交于 2019-12-20 15:23:11
问题 I have an ios5 app developed using storyboards that currently displays a tab bar controller view on initial launch. I would like to display a login screen before the tab bar controller is displayed. The user would enter his username & password, the system would then authenticate the user and then if successful, display the tab bar controller. I have tried the following 3 options with no luck.. any ideas ? (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:

Where does input validation belong in an MVC application?

非 Y 不嫁゛ 提交于 2019-12-20 10:24:32
问题 I have a MVC application that receives an input from a form. This is a login form so the only validation that is necessary is to check whether the input is non-empty. Right now before I pass it to the model I validate it in the controller. Is this a best practice or not? Does it belong to the model? 回答1: I don't think there's an official best practice limiting validation to any single part of the MVC pattern. For example, your view can (and should) do some up-front validation using Javascript

What is the proper way to test 'create' controller actions?

杀马特。学长 韩版系。学妹 提交于 2019-12-20 09:51:12
问题 I am using Ruby on Rails 3.2.2, Rspec 2.9.0 and RspecRails 2.9.0. I would like to test the create controller action but I don't know how to make that the "right"/"proper" way. I "scaffolded" model, controller, view, ... files, so in those files I have the common code generated by Ruby on Rails generators; in my spec file I have: it "assigns @article" do new_article = FactoryGirl.build(:article) Article.should_receive(:new).and_return(new_article) post :create assigns[:article].should eq(new

AngularJS: Read route param from within controller

喜你入骨 提交于 2019-12-20 09:39:54
问题 How can a parameter from an URL be read within an AngularJS controller? Let's say I have an URL like http://localhost/var/:value and I want the value to be stored in a variable within the controller for the /var/:value URL. I have tried using $routeParams.value and $route.current.params.value but $routeParams is undefined at the beginning and $route doesn't work. 回答1: The problem is that you probably inject $routeParams or $route in a controller that is run before a route change has occurred,

CodeIgniter: global variables in a controller

人走茶凉 提交于 2019-12-20 09:36:16
问题 I'm a very newbie on CodeIgniter, and while I go on I run into problems that, in the procedural coding, were easy to fix The current issue is: I have this controller class Basic extends Controller { function index(){ $data['title'] = 'Page Title'; $data['robots'] = 'noindex,nofollow'; $data['css'] = $this->config->item('css'); $data['my_data'] = 'Some chunk of text'; $this->load->view('basic_view', $data); } function form(){ $data['title'] = 'Page Title'; $data['robots'] = 'noindex,nofollow';

extjs - how correctly call a controller method from another controller or closure

喜欢而已 提交于 2019-12-20 09:32:03
问题 I'm new to extjs and I'm using the MVC architecture. When my application references a method of a controller, I do it that way (in MyApp.Application ): Mb.app.getController('Main').myMethod(); It is already long, but I think this is the way to do. When a controller calls it's own method in a closure, I was led to use this code (in MyApp.controller.Main : controllerMethodOne: function(){ Ext.Ajax.request({ url: ..., params: ..., success: (function(response){ list = Ext.JSON.decode(response