标签: angular-dart

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

Angular 2 Dart:如何检测点击除元素之外的所有内容?

在一个组件中包含许多不同组件的应用程序中,我有一个自定义自动建议框.如果用户点击自动建议框(或包含自动建议框的元素)的任何位置,则应关闭该框.

这就是我在jQuery中要做的事情:

$(document).on('click','body',function(e) {
if(e.target!='.suggestbox' && $(e.target).parent('.suggestbox').length <1 ) {
$('.suggestbox').remove();
}
});
Run Code Online (Sandbox Code Playgroud)

但是在我的Angular Dart模板中,我有:

index.html的:

<body>
<my-app>
// sub component
// sub sub component
</my-app>
</body>
Run Code Online (Sandbox Code Playgroud)

我可以想到在my-app组件中检测到最顶层包装器上的点击并将操作发送到子组件但是这仍然不是主体点击的可能性.

解决这个问题的最佳方法是什么?

events dart angular-dart angular2-dart angular

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

如何在VS代码上设置AngularDart5

我已经搜索了关于如何在Visual Studio Code上有效设置Angular Dart 5的文档,但到目前为止还没有找到任何结论.

我已经搜索过的地方:

用于dart的VS Code插件不提供创建新空项目的功能.所以我现在不知所措.

我如何在VS Code IDE上设置AngularDart 5项目?有人可以向我推荐相同的资源吗?

dart dart-webui angular-dart visual-studio-code angular

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

找不到带有简单组件的RadioControlRegistry提供程序

我有简单的Angular-Dart组件,尝试ngModel在单选输入中将connect属性设置为,应用正确编译,但是浏览器控制台给我错误:

No provider found for RadioControlRegistry: RadioControlValueAccessor -> RadioControlRegistry.
Run Code Online (Sandbox Code Playgroud)

代码:

import 'package:angular/angular.dart';
import 'package:angular_forms/angular_forms.dart';

@Component(
  selector: 'order-question-test',
  template: '''
    <input type="radio" name="food" [(ngModel)]="foodChicken">
    <input type="radio" name="food" [(ngModel)]="foodFish">
       ''',
  directives: [
    coreDirectives,
    formDirectives,
  ]
)

class OrderQuestion {
  RadioButtonState foodChicken = RadioButtonState(true, "chicken");
   RadioButtonState foodFish = RadioButtonState(false, "fish");
  OrderQuestion ();
}
Run Code Online (Sandbox Code Playgroud)

pubspec.yaml

environment:
  sdk: '>=2.2.0 <3.0.0'

dependencies:
  angular: ^5.2.0
  angular_components: ^0.13.0
  json_annotation: ^2.0.0

dev_dependencies:
  angular_test: ^2.2.0
  build_runner: ^1.5.0
  build_test: ^0.10.3
  build_web_compilers: ^1.0.0
  json_serializable: ^2.0.0
  pedantic: ^1.0.0
  test: ^1.5.1
Run Code Online (Sandbox Code Playgroud)

怎么了?

dart angular-dart angular

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

Angular Dart 有类似 jsfiddle.net 的东西吗?

有没有人知道像jsfiddle.net这样的在线服务,但是对于 Angular Dart Code?

dart angular-dart

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

在进行硬刷新时,路由对我不起作用

我在看这个源代码:https://github.com/angular/angular.io/blob/master/public/docs/_examples/toh-5/dart/lib/app_component.dart

而且当我转到根目录时,我的应用程序似乎正在路由.

本地主机:8080 /

当我在我的应用程序中移动时路由更新,但似乎如果我在某个东西: localhost:8080/dashboard在一个basecase中,并进行硬刷新,它失败了.它会给我一个404 not found!错误.

如果我这样做它会工作:localhost:8080/#!/dashboard但这不是传递给我的应用程序的地址.

在index.html我有: <base href="/">

我的App_Component.dart文件如下:

import 'package:angular2/angular2.dart';
import 'package:angular2/router.dart';

import 'hero_component.dart';
import 'heroes_component.dart';
import 'dashboard_component.dart';
import 'hero_service.dart';
@Component(
    selector: "my-app",
    directives: const [ROUTER_DIRECTIVES],
    providers: const [HeroService, ROUTER_PROVIDERS],
    templateUrl: "app_component.html")
@RouteConfig(const [
  const Route(
      path: "/dashboard",
      name: "Dashboard",
      component: DashboardComponent,
      useAsDefault: true),
  const Route(
      path: "/detail/:id", name: "HeroDetail", component: HeroDetailComponent),
  const Route(path: "/heroes", name: "Heroes", component: HeroesComponent)
])
class AppComponent {
  String title = "Tour …
Run Code Online (Sandbox Code Playgroud)

angular-dart angular2-routing angular

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

AngularDart 中的 somecomponent.template.dart 导入指向什么?

我只是在阅读 AngularDart路由教程并遇到了这个代码片段。

import 'package:angular/angular.dart';
import 'package:angular_router/angular_router.dart';

import 'route_paths.dart' as paths;
import 'crisis_list_component.template.dart' as clct;
import 'hero_list_component.template.dart' as hlct;

@Injectable()
class Routes {
  static final _crises = new RouteDefinition(
    routePath: paths.crises,
    component: clct.CrisisListComponentNgFactory,
  );

  static final _heroes = new RouteDefinition(
    routePath: paths.heroes,
    component: hlct.HeroListComponentNgFactory,
  ); ..... see routing tutorial link above.
}
Run Code Online (Sandbox Code Playgroud)

有什么作用

import 'crisis_list_component.template.dart' as clct;
import 'hero_list_component.template.dart' as hlct;
Run Code Online (Sandbox Code Playgroud)

实际导入?

dart angular-dart angular-dart-routing

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

webdev 为 .js.map 文件提供丢失的输出

运行webdev serve并尝试调试错误时。我没有看到任何.js.map用于调试的dart 源代码或文件。

可能有什么问题?这是一个使用最新 Dart 2 的全新 angulardart 项目,并且webdev 0.2.4

dart angular-dart

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

枚举可以在 AngularDart 模板中使用吗?如何?

如果我有一个枚举,例如:

@Component(...)
class MyComponent {

    MyEnum myEnum;
    ...
}
Run Code Online (Sandbox Code Playgroud)

如何在模板中使用此枚举?例如

<div *ngIf="myEnum == MyEnum.SOME_OPTION">
    ...
</div>
Run Code Online (Sandbox Code Playgroud)

编辑:我对如何使用枚举进行比较特别感兴趣。

dart angular-dart

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

我们可以使用 flutter 或 Dart 制作 Web 应用程序或网站吗

“我正在转向使用新语言来创建跨平台应用程序(flutter),但我对创建 Web 应用程序或网站感到困惑,是否可以使用 Dart 和 flutter 进行制作。

dart angular-dart flutter

5
推荐指数
2
解决办法
6270
查看次数