小编Dyl*_*lan的帖子

在AngularJs 1.7.2中使用NgRef降级Angular 5组件

我正在开发Angular 1.7.2中的一个项目,它利用了Angular 5/6中构建的一些组件.我们正在使用downgradeComponent工具降级组件,一切正常.

我们最近添加了一个我们需要集成的新组件,但我们也需要访问组件属性.我正在研究ngRef指令,但这似乎不起作用,我无法在Angular文档之外找到任何其他ngRef示例.当我添加ngRef并将其绑定到当前作用域中的变量时,它永远不会被分配.任何帮助,将不胜感激!

Angular 5组件

export class ImportedComponent implements OnInit {

    variable1: boolean = true;
    variable2: boolean = false;

    constructor(private certService: ImportedComponent) { }

    ngOnInit() {
        this.variable1 = true;
        this.variable2 = false

    }
}
Run Code Online (Sandbox Code Playgroud)

Html - w/AngularJS 1.7.2

<imported ng-ref="importedProperty" ></imported>

<custom-button ng-if="importedProperty.variable1"  [disabled]="!importedProperty.variable2"></custom-button>
Run Code Online (Sandbox Code Playgroud)

降级

angular
  .module("blah", [])
  .directive(
    "imported",
  downgradeComponent({ component: ImportedComponent }) as angular.IDirectiveFactory
  );
Run Code Online (Sandbox Code Playgroud)

降级导入的组件正在运行,因为HTML正在显示,我能够看到console.log()从他们的结束发生,但是当我尝试访问时importedProperty,我得到未定义(或者如果我初始化它的空对象)因此在我的范围之前)

angularjs angularjs-directive angular

8
推荐指数
1
解决办法
501
查看次数

用于 Internet Explorer 的目录上传

我在我的页面上使用 webkitdirectory 属性来允许用户上传整个目录:

<input webkitdirectory type="file" />
Run Code Online (Sandbox Code Playgroud)

这适用于 Chrome、Firefox 和 Edge,但不支持 Internet Explorer。是否有其他选择来支持 IE?

html browser internet-explorer google-chrome

6
推荐指数
1
解决办法
4052
查看次数

Emacs 24.4.1中的下标未正确显示

我正在进行使用unicode下标k("\ _k")的赋值.但是,我没有得到下标k,而是得到了这个:

![] [1]

仍然可以使用带有数字和一些字母的下标,但不能使用'k'.

我最初遇到了emacs 24.3的问题,然后被告知更新到24.4.这个问题仍然存在.

有没有其他人有这个问题,并找到了解决方案?

我在使用Emacs v.24.4.1的Mac上运行

提前致谢

编辑

这是我的.emacs文件:

(load-file (let ((coding-system-for-read 'utf-8))
             (shell-command-to-string "agda-mode locate")))

(set-default-font "-apple-DejaVu_Sans-medium-normal-normal-*-*-*-*-*-p-0-iso10646-1")
; Change Control-c Control-, and Control-c Control-. in Agda mode
; so they show the normalized rather than the "simplified" goals
(defun agda2-normalized-goal-and-context ()
  (interactive)
  (agda2-goal-and-context '(3)))
(defun agda2-normalized-goal-and-context-and-inferred ()
  (interactive)
  (agda2-goal-and-context-and-inferred '(3)))
(eval-after-load "agda2-mode"
  '(progn
     (define-key agda2-mode-map (kbd "C-c C-,")
       'agda2-normalized-goal-and-context)
     (define-key agda2-mode-map (kbd "C-c C-.")
       'agda2-normalized-goal-and-context-and-inferred)))

; This defines backslash commands for some extra symbols.
(eval-after-load …
Run Code Online (Sandbox Code Playgroud)

unicode emacs agda

3
推荐指数
1
解决办法
420
查看次数

Internet Explorer上的Javascript语法错误

我有以下一些代码调整一些解析数据的标题:

    var parsedData = transposed.map(row =>
        row.reduce((acc, col, ind) => {
            acc[headers[ind]] = col;
            return acc;
        }, { }));
Run Code Online (Sandbox Code Playgroud)

该代码在Chrome/Edge/Firefox上正常运行,但在Internet Explorer上失败,说法语错误:row =>.

我无法确定抛出语法错误的位置 - 我对javascript的map函数比较新,所以我可能会遗漏一些东西.上面的代码片段中的语法错误是什么?

html javascript

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