小编Mav*_*k09的帖子

Angular-cli.json,webpack.conf和tsconfig.json之间的区别

我正在构建一个angular4 /打字本桌面应用程序并且介于两者之间

angular-cli.json
tsconfig.json
webpack.conf.js

  1. 有人可以解释以上3个配置文件中的主要概念差异及其用途是什么?
  2. 我是否必须在我的项目中定义所有3个,或者只有一个就足够了.

    例如:路径ALIAS可以在其中所有3个webpack/tsconfig/angular-cli中定义.但哪一个比其他人受益?或者它们都一样,无论你使用哪种.

  3. 因此,一般来说,它们都可以提供项目配置,以便最佳性能和推荐最佳实践.

角cli.json

{
    "project": {
        "version": "1.0.0-beta",
        "name": "project"
    },
    "apps": [
        {
            "root": "src",
            "outDir": "dist",
            "assets": [
                "images",
                "favicon.ico"
            ],
            "index": "index.html",
            "main": "main.ts",
            "test": "test.ts",
            "tsconfig": "tsconfig.json",
            "prefix": "app",
            "mobile": false,
            "styles": [
                "styles.css"
            ],
            "scripts": [
                "../node_modules/core-js/client/shim.min.js",
                "../node_modules/mutationobserver-shim/dist/mutationobserver.min.js",
                "../node_modules/@webcomponents/custom-elements/custom-elements.min.js",
                "../node_modules/web-animations-js/web-animations.min.js"
            ],
            "environmentSource": "environments/environment.ts",
            "environments": {
                "dev": "environments/environment.ts",
                "prod": "environments/environment.prod.ts"
            }
        }
    ],
    "addons": [],
    "packages": [],
    "e2e": {
        "protractor": {
            "config": "./protractor.config.js"
        }
    },
    "test": {
        "karma": { …
Run Code Online (Sandbox Code Playgroud)

tsconfig angular-cli angular webpack.config.js

8
推荐指数
3
解决办法
4620
查看次数

AngularJS - 指令双向绑定不适用于隔离范围

我正在构建一个演示天气应用程序,通过使用控制器/提供者和 2 个指令,(具有独立的范围,一个用于渲染一周值得预测的指令和另一个用于在页面顶部显示点击的工作日预测的指令)。

单击工作日之一时,我试图在屏幕顶部显示单击的工作日。如果我删除指令中的隔离范围,这可以正常工作,但是它不适用于适当的隔离范围。

有人可以建议我在这里缺少什么吗?

链接:具有独立作用域的指令:http : //plnkr.co/edit/L9AcMv ? p=preview这不起作用?我在这里缺少什么?

代码供您参考:

    app.directive('myWeather', function() {
      return {
        restrict: 'EA',
        transclude: 'true',
//If I comment below scope then it works fine though it does not if I am using isolated scope
        scope: {
          place: '=' //Two-way data binding
        },
        templateUrl: 'my-weather.html'
      };
    });

    app.directive('selectedWeather', function() {
      return {
        restrict: 'EA',
        transclude: 'true',
//If I comment below scope then it works fine though it does not if I …
Run Code Online (Sandbox Code Playgroud)

directive angularjs

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