我正在构建一个 Angular 消息组件:
<app-info-card>
  my message here
</app-info-card>
Run Code Online (Sandbox Code Playgroud)
这是我的组件:
import {AfterViewInit, Component, ContentChild, ElementRef, Input, OnInit} from '@angular/core';
@Component({
  selector: 'app-info-card',
  templateUrl: './info-card.component.html',
  styleUrls: ['./info-card.component.css']
})
export class InfoCardComponent implements OnInit, AfterViewInit {
  @ContentChild('app-info-card') messageRef: ElementRef;
  message: string;
  constructor() {
  }
  ngOnInit() {
  }
  ngAfterViewInit() {
    this.message = this.messageRef.nativeElement.innerHTML;
    console.log(this.messageRef.nativeElement.innerHTML);
  }
}
Run Code Online (Sandbox Code Playgroud)
这给了我一个 messageRef 未定义的错误。我试图从组件选择器“我的消息”中获取内部文本到组件的消息字段中。有没有办法在不添加属性的情况下做到这一点?
我正在开始使用PHP,我第一次使用框架作为项目的基础.我决定使用Zend Framework 2.
我将通过Github控制项目的版本.
将所有框架文件包含在项目存储库中,更新并提交框架的更新作为我的存储库的一部分是否正常?或者它通常是否保持独立,以便您可以从我的项目的存储库版本安装时下载并使用当前的存储库版本?
我目前只使用模拟器,但我在 iOS 模拟器上快速使用 CoreLocation 时遇到问题。我得到此代码打印的位置更新,但从未标题。我不想要当然,我正在尝试制作一个指南针类型的应用程序,它将显示目标的方位。
class CompassViewController: UIViewController, CLLocationManagerDelegate {
    var lm:CLLocationManager = CLLocationManager()
    override func viewDidLoad() {
        super.viewDidLoad()
        print ("view did load")
        lm.delegate = self;
        lm.desiredAccuracy = kCLLocationAccuracyBest
        lm.requestWhenInUseAuthorization()
        lm.startUpdatingLocation()
        lm.startUpdatingHeading()
    }
    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        var locValue:CLLocationCoordinate2D = manager.location!.coordinate
        var course = manager.location!.course
               print("locations = \(locations)")
    }
    func headingManger(_ manager: CLLocationManager, didUpdateHeading: [CLHeading]) {
        var heading = manager.heading?.magneticHeading
        print("heading = \(heading)")
    }
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试了几种这种组合。我尝试做一个处理位置和标题的函数,但根本没有打印任何数据。我也尝试过只使用 HeadingManager 功能,但没有打印任何内容。上面的当前代码将打印位置,但不会打印标题。
我怎样才能去上班?
有没有一种方法可以将Handlebars模板预编译为纯HTML?车把预编译产生一个js文件。我可以在节点上运行该JS来生成HTML文件吗?这就是我正在尝试的方法:
// Get a Handlebars instance
var hb = require("handlebars");
// Load a template
import fs = require('fs');
var template:string = fs.readFileSync('templates/template.handlebars','utf8');
// Compile said template
var compiled = hb.precompile(template);
// Write JS file
fs.writeFileSync('compiled/template.js', compiled);
var test = compiled.main();
// Write HTML file
fs.writeFileSync('compiled/template.html', test);
Run Code Online (Sandbox Code Playgroud)
这是因为编译失败。main不是函数。虽然那里有一个主要功能,我正在尝试达到。
我有以下 Dockerfile:
FROM continuumio/anaconda3
VOLUME /code
Run Code Online (Sandbox Code Playgroud)
我使用以下命令行执行它:
docker run -it 626058fb269a --mount src="$(pwd)",target=/code,type=bind /bin/bash
Run Code Online (Sandbox Code Playgroud)
但是我收到这个错误:
[FATAL tini (8)] exec --mount failed: No such file or directory
Run Code Online (Sandbox Code Playgroud)
显然我错过了一些东西。如果运行 docker run -it 626058fb269a /bin/bash,目录就在那里,但显然没有安装任何东西。我只想从容器访问我的代码。我怎样才能正确安装这个?
angular ×1
docker ×1
git ×1
github ×1
ios ×1
node.js ×1
php ×1
repository ×1
swift ×1
typescript ×1