下面的AngularJS应用程序是用TypeScript编写的
我在主要应用程序中对应用程序进行了分类:
module MainApp {
export class App {
public static Module : ng.IModule = angular.module("mainApp", [])
}
}
和我的控制器
module MainApp {
export class Person {
public firstName: string;
public lastName: string;
}
ex
我正在创建一个指令,可以从内部和外部更新。该指令只是一个包含图标、标题和加载状态的框。正在通过隔离作用域参数从外部更新此指令。从内部更新它将需要内部指令来要求"box指令“的控制器,并在其中使用函数。
我想知道这是否是解决这个问题的最佳实践(事件不是选项) 8-)
指令
(function () {
'use strict';
var app = angular.module('mainApp');
app.directive('arBox', function () {
// You can set the title
我在第一个模块中有一个父控制器,在第二个模块中有一个“子”控制器。第二个模块依赖于第一个模块。我希望我的“子”控制器继承“父”控制器。但问题是如何调用“父”控制器方法。
例如:
SecondModule.controller("childBrowseCtrl", function($scope, $injector, $controller){
$injector.invoke(ParentBrowseCtrl, this, {$scope:$scope});
//this overrides the onedit function from
我知道AngularJS有一些依赖注入技术。因此,如果代码是和mainApp.value("defaultInput",5);将数据传递给控制器。
//define a module
var mainApp = angular.module("mainApp", []);
//create a value object as "defaultInput" and pass it a data.
mainApp.value("defaultInput", 5);
...
//inject the value in the con
我正在使用JavaFX显示我的游戏视图。
在调用MainApp类中的方法时,将加载视图:
public class MainApp extends Application {
//fields
public MainApp() {
this.game = new Game();
}
//lots of other methods
public void showGameView() {
try {
System.out.println(game.getPlayer().getCurrentR