在Typescript中向rootscope添加值时出错.
class TestClass{
this.rootScope: ng.IRootScopeService;
constructor($rootScope){
this.rootScope = $rootScope;
}
addValueToRoot=()=>{
this.rootScope.val1 = "something"; //Error: Property doesn't exist on the IRootScopeService
}
}
Run Code Online (Sandbox Code Playgroud) 尝试使用html-loader插件在TypeScript中导入html :
import buttonHtml from './button.html';
Run Code Online (Sandbox Code Playgroud)
出现TypeScript错误:
TS2307:找不到模块'./button.html'
Webpack配置:
const path = require('path');
module.exports = {
entry: {
'background.js':path.resolve(__dirname, './background.ts'),
'content.js': path.resolve(__dirname,'./content.ts')
},
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.html$/,
exclude: /node_modules/,
use: {loader: 'html-loader'}
}
]
},
resolve: {
extensions: [ ".tsx", ".ts", ".js" ]
},
output: {
filename: '[name]',
path: path.resolve(__dirname, 'dist')
}
};
Run Code Online (Sandbox Code Playgroud) html typescript webpack webpack-html-loader typescript-typings
如何在自定义过滤器中使用角度$ filter?如何注入$ filter依赖?
module Filters {
export class CustomFilter {
public static Factory() {
return function (input:<any>) {
var result = [];
//Would like to utilize $filter.('filter') here
return result;
}
}
}
angular.module('app')
.filter('customFilter', [CustomFilter.Factory]);
}
Run Code Online (Sandbox Code Playgroud) 我找到了这个链接来完成full-text search工作linq.但是,代码似乎是针对性的database first approach.如何使它工作Database First Approach?
代码的相关部分:
public class NoteMap : EntityTypeConfiguration<Note>
{
public NoteMap()
{
// Primary Key
HasKey(t => t.Id);
}
}
public class MyContext : DbContext
{
static MyContext()
{
DbInterception.Add(new FtsInterceptor());
}
public MyContext(string nameOrConnectionString) : base(nameOrConnectionString)
{
}
public DbSet<Note> Notes { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new NoteMap());
}
}
Run Code Online (Sandbox Code Playgroud)
如上所示,该函数OnModelCreating仅被调用Code First Approach.我想知道需要改变什么才能使链接中的代码适用于Database First方法
由于某种原因,我无法在Chrome扩展程序中加载源地图。
正在为Chrome扩展程序加载的文件夹位于文件.map旁边.js。该.js文件的行//# sourceMappingURL=1.9215106f1980d05d2b4c.js.map引用.map文件路径。
但是,由于某些原因,Chrome开发者工具无法加载地图。
我仔细检查了Chrome设置,以确保js源地图已打开并且正在使用简单的Angular项目。
另外,请确保清单文件中包含以下内容:
"web_accessible_resources":[
"*.map"
],
Run Code Online (Sandbox Code Playgroud) javascript google-chrome-extension google-chrome-devtools source-maps webpack
我正在尝试访问单一存储库中另一个项目中定义的类型。以下是项目的结构
-- packages
-- project-a
-- tsconfig.json
-- project-b
-- tsconfig.json
-- shared
-- src
-- UserModel.ts
-- index.ts
-- tsconfig.json
-- tsconfig.base.json
-- package.json
-- tsconfig.json (Default no changes here)
Run Code Online (Sandbox Code Playgroud)
tsconfig.base.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDecoratorMetadata": true,
"module": "commonjs",
"noEmit": false,
"composite": true
},
"files": [],
"references": [{ "path": "./shared" }]
}
Run Code Online (Sandbox Code Playgroud)
共享 tsconfig.json
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"baseUrl": "./",
"rootDir": "src",
"composite": true,
"experimentalDecorators": true,
"declaration": true,
"declarationMap": true
}, …Run Code Online (Sandbox Code Playgroud) 我试图在下拉列表中添加Datepicker,如下所示,并设置autoClose ="outsideClick".但是,当按下任何月份按钮时,它会切换下拉列表.怎么解决这个?
Html代码:
<div class="date-wrap pull-right" dropdown auto-close="outsideClick">
<button class="btn btn-info" dropdown-toggle>Date Picker</button>
<div class="dropdown-menu datepicker" role="menu">
<datepicker show-weeks="false" ng-model="dt"></datepicker>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
Plunker:http://plnkr.co/edit/lBn3Oo?p = preview
尝试复制整个电子表格,但我想没有api可以这样做。
基本上,我正在尝试执行以下操作:
可以正常创建新的电子表格,但是无法从电子表格复制表格。
尝试了2种方法:
角度:
$http.post("https://sheets.googleapis.com/v4/spreadsheets/"+fromSpreadsheetId+"/sheets/"+fromSheetId,
{headers: {
'Authorization': 'Bearer ' + this.oauthToken
}},
Run Code Online (Sandbox Code Playgroud)
给出以下错误:
对预检请求的响应未通过访问控制检查:否'Access-Control-Allow-Origin'
Google Sheets Api调用:
gapi.client.sheets.spreadsheets.sheets.copyTo({spreadsheetId: fromSpreadsheetId , sheetId: fromSheetId},{destinationSpreadsheetId: destinationSpreadsheetId});
Run Code Online (Sandbox Code Playgroud)
请求通过没有任何错误。但是,新创建的电子表格没有复制工作表。
更新到 RxJs 5 后,我收到以下错误:
share is not a function
代码:
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import { Injectable } from '@angular/core';
import { share } from "rxjs/operators/share";
import * as m from '../../models/app.models';
@Injectable()
export class SharedService {
observable: Observable<any>;
observer: Observer<any>;
constructor() {
var temp = Observable.create((observer: Observer<any>) => {
this.observer = observer;
});
this.observable = temp.share(); <- Error here
}
broadcast(event: m.SharedEventModel) {
this.observer.next(event);
}
on(eventName, callback) {
return this.observable.filter((event) => …Run Code Online (Sandbox Code Playgroud) 目前我google.picker.?ViewId.FOLDERS在谷歌驱动器选择器中使用视图。但是,这显示了我的驱动器中的所有文件夹(包括深层文件夹)。
如何实现一开始只显示顶级文件夹的视图?这类似于 Dropbox 选择器的文件视图。
我只想从具有格式的电子表格中检索工作表的数据。
如何使用Sheets Api实现相同功能?
angularjs ×4
javascript ×4
typescript ×4
angular ×2
webpack ×2
angular-ui ×1
c# ×1
datepicker ×1
formatting ×1
html ×1
linq ×1
rxjs ×1
service ×1
source-maps ×1