小编And*_*res的帖子

Delphi DLL在C#中 - var array作为参数

我需要在我的C#代码中使用Delphi DLL.

使用具有公共参数的其他方法时我取得了一些成功,但在这种情况下,解决方案仍然隐藏.

DLL文档提供了此声明:

Function Get_Matrix (var Matrix : array [ 1..200 ] of char) : boolean ; stdcall;
Run Code Online (Sandbox Code Playgroud)

我试着用:

[DllImport("DLL.dll")]
public static extern bool Get_Matrix(ref char[] Matrix);
Run Code Online (Sandbox Code Playgroud)

不成功.一些帮助?

c# arrays delphi dll

7
推荐指数
1
解决办法
2414
查看次数

Angular.js从外部控制器调用$ http.get

我有一个HTTP资源,它返回数据库中前10个实体的JSON列表.我这样称呼它:

var filter= "john";
var myApp = angular.module('myApp', []);
myApp.controller('SearchController', ['$scope','$http', function ($scope, $http) {
    $http.get('/api/Entity/Find/' + filter). //Get entities filtered
        success(function (data, status, headers, config) {
            $scope.entities = data;
        }).
        error(function () {
        });
    }]);
Run Code Online (Sandbox Code Playgroud)

有用!

但是......如何更改filter变量以更改查询?我应该重写整个控制器以使其工作吗?

更新

很抱歉我的问题不够明确.当我问这个时,我无法承担任何AngularJS.

我最初的意图是$http注入变量,而不依赖于为此创建控制器.

谢谢大家.

javascript angularjs angularjs-scope

7
推荐指数
2
解决办法
7327
查看次数

'router-outlet'在主模板上没有'routerLink'时无法正常工作

我刚刚使用Angular CLI创建了一个新的角度项目,并使用以下命令在其中搭建了一个新的路由用户.

ng new myproj
cd myproj 
ng g route user
Run Code Online (Sandbox Code Playgroud)

然后我使用了Angular CLI服务器ng serve.

但是当我访问页面时,我无法看到登录模板的内容,/login除非我添加了某个路径的链接,即:

<a [routerLink]="['/user']">User Info</a>
Run Code Online (Sandbox Code Playgroud)

当我添加上面的行,然后router-outlet填充,但如果我删除此行,则router-outlet再次呈现为空.

这里发生了什么事?

有人知道为什么会这样吗?

示例文件

/src/app/myproj.component.ts

import { Component } from '@angular/core';
import { Routes, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from '@angular/router';

@Component({
  moduleId: module.id,
  selector: 'myproj-app',
  templateUrl: 'myproj.component.html',
  styleUrls: ['myproj.component.css'],
  directives: [ROUTER_DIRECTIVES],
  providers: [ROUTER_PROVIDERS]
})
@Routes([
  {path: '/user', component: UserComponent}
])
export class MyprojAppComponent {
  title = 'Main Component working!';
} …
Run Code Online (Sandbox Code Playgroud)

angular2-routing angular-cli angular

5
推荐指数
1
解决办法
1万
查看次数

如何获取 Angular 2 中当前模块的元数据?

我想获取当前NgModule的元数据,以便获取列表declarationsproviders填充我创建的动态模块,以在模式中显示组件。

那怎么办呢?

metadata angular2-aot angular2-modules angular

5
推荐指数
1
解决办法
3326
查看次数