小编Flo*_* Gl的帖子

string.LastIndexOf()Bug?

有谁知道原因:

"  <exception>".LastIndexOf("<",0) returns -1 (wrong)
Run Code Online (Sandbox Code Playgroud)

"  <exception>".LastIndexOf("<") returns 2 (right)
Run Code Online (Sandbox Code Playgroud)

"<exception>".LastIndexOf("<",0) returns 0 (right)
Run Code Online (Sandbox Code Playgroud)

这是一个错误还是我误解了LastIndexOf-Method?

c# string indexof

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

通过iOS将数据发送到POST JSON Web服务

我想使用以下代码将数据传递给POST JSON Web服务.

NSString *urlString = @"http://3.10.204.99:9090/service/outage/data/getShortFormData";
NSDictionary *inputData = [[NSDictionary alloc] initWithObjectsAndKeys:
                           @"1020", @"outageId",
                           @"Alex", @"customerName",
                           nil];

NSError *error = nil;
NSData *jsonInputData = [NSJSONSerialization dataWithJSONObject:inputData options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonInputString = [[NSString alloc] initWithData:jsonInputData encoding:NSUTF8StringEncoding];
[self checkWithServer:urlString jsonString:jsonInputString];    
Run Code Online (Sandbox Code Playgroud)

-(void)checkWithServer:(NSString *)urlname jsonString:(NSString *)jsonString{

    NSURL *url1 = [NSURL URLWithString:urlname];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url1];
    [request setHTTPMethod:@"POST"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [request setValue:@"charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];
    NSURLResponse *response;
    NSError *err;
    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
    id jsonResponseData = [NSJSONSerialization JSONObjectWithData:responseData …
Run Code Online (Sandbox Code Playgroud)

post json ios

8
推荐指数
2
解决办法
2万
查看次数

使用AOT抛出无法查找组件工厂,在延迟加载的模块中动态渲染组件

目前的行为

我将这些动态组件声明为模块中的入口组件,我也想在其中呈现它们.使用JIT它可以正常工作.以下结构有我的应用程序的一部分,我想渲染它们:app -> home (lazy) -> contracts (lazy) -> search.

所以我将这些组件添加到我用于的模块中search component/route.当我使用AOT进行编译时,每次访问搜索路径时,该应用程序都会告诉我没有组件工厂.当然我搜索谷歌并找到了一些结果:

我尝试将它们添加到ANALYZE_FOR_ENTRY_COMPONENTS提供程序中,我尝试.forRoot()在我的app.module中导入ModuleWithProviders,我也尝试在根模块(app.module)中导入和声明我的动态及其所有依赖组件.一切都导致了同样的错误.

我声明我的动态组件作为入口组件,如:所以

@NgModule({
  imports: [SharedComponentsModule, FinoSchemaFormsModule, TabGroupModule, FinoInputModule],
  declarations: [EnergySearchSettingsComponent, DslSearchSettingsComponent, MobileSearchSettingsComponent, ComparisonDetailSectionComponent],
  entryComponents: [EnergySearchSettingsComponent, DslSearchSettingsComponent, MobileSearchSettingsComponent],
  exports: [EnergySearchSettingsComponent, DslSearchSettingsComponent, MobileSearchSettingsComponent, ComparisonDetailSectionComponent],
  providers: [CategoryMappingProvider]
})
export class ComparisonComponentsModule { }
Run Code Online (Sandbox Code Playgroud)

This module gets imported in the SearchModuleSearchComponent的声明.在这个组件中,我想使用ComponentFactoryResolverI注入动态渲染这些组件SearchComponent.

ngOnInit() {
    this.searchSettingsComponent = this.comparisonService.getSearchComponent(); // returns either EnergySearchSettingsComponent, DslSearchSettingsComponent or MobileSearchSettingsComponent
    let componentFactory = this.componentFactoryResolver.resolveComponentFactory(searchSettingsComponent); …
Run Code Online (Sandbox Code Playgroud)

javascript lazy-loading angular angular5

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

Css在IE/Firefox中支持形状

有谁知道IE和Firefox是否以及何时支持css形状功能,特别是shape-outside

css shape css-shapes

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

标签 统计

angular ×1

angular5 ×1

c# ×1

css ×1

css-shapes ×1

indexof ×1

ios ×1

javascript ×1

json ×1

lazy-loading ×1

post ×1

shape ×1

string ×1