小编nas*_*ash的帖子

Yeoman Angular-Fullstack新路线不重定向

我正在使用angular-fullstack生成器来开发我的项目.当我尝试使用命令创建新路由时(我已经安装了uiRouter):

yo angular-fullstack:route search
Run Code Online (Sandbox Code Playgroud)

所有文件都已成功创建.但每当我尝试打开该路线时,我都会被重定向回主页.配置是自动生成的,如下所示:

search.js

'use strict';

angular.module('tachologyApp')
  .config(function ($stateProvider) {
    $stateProvider
      .state('search', {
        url: '/search',
        template: '<search></search>'
      });
  });
Run Code Online (Sandbox Code Playgroud)

search.controller.js

'use strict';

(function(){

class SearchComponent {
  constructor() {
    this.message = 'Hello';
  }
}

angular.module('tachologyApp')
  .component('search', {
    templateUrl: 'app/search/search.html',
    controller: SearchComponent,
    controllerAs: 'searchCtrl'
  });

})();
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激.

javascript yeoman angular-fullstack

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

如何防止 npm 安装后出现 Webpack 错误?

我当时正在做一个项目,一切都很顺利,直到我做到了npm install

\n\n

然后,Webpack 抛出以下错误:

\n\n
new ForkCheckerPlugin(),\n        ^\nTypeError: ForkCheckerPlugin is not a constructor\n    at makeWebpackConfig (/home/nsanz/Documentos/git/tachology/webpack.make.js:252:9)\n    at Object.exports.default (/home/nsanz/Documentos/git/tachology/server/config/express.js:86:27)\n    at Object.<anonymous> (/home/nsanz/Documentos/git/tachology/server/app.js:28:1)\n    at Module._compile (module.js:570:32)\n    at loader (/home/nsanz/Documentos/git/tachology/node_modules/babel-register/lib/node.js:144:5)\n    at Object.require.extensions.(anonymous function) [as .js] (/home/nsanz/Documentos/git/tachology/node_modules/babel-register/lib/node.js:154:7)\n    at Module.load (module.js:487:32)\n    at tryModuleLoad (module.js:446:12)\n    at Function.Module._load (module.js:438:3)\n    at Module.require (module.js:497:17)\n    at require (internal/module.js:20:19)\n    at Object.<anonymous> (/home/nsanz/Documentos/git/tachology/server/index.js:12:28)\n    at Module._compile (module.js:570:32)\n    at Object.Module._extensions..js (module.js:579:10)\n    at Module.load (module.js:487:32)\n    at tryModuleLoad (module.js:446:12)\n    at Function.Module._load (module.js:438:3)\n    at Module.runMain (module.js:604:10)\n    at run (bootstrap_node.js:389:7)\n    at startup (bootstrap_node.js:149:9)\n    at …
Run Code Online (Sandbox Code Playgroud)

node.js webpack angular-fullstack isparta

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

使用 Mapbox 单击更改多边形颜色

我有一个灰色层来在 Mapbox 地图上显示多个多边形。当用户单击它以显示“选定”多边形时,我试图仅更改其中一个的颜色。我不想要交互,这就是为什么我不使用 Draw 库,只是为了显示选定的多边形。

在此处输入图片说明

有没有办法只在一层中做到这一点?我尝试向boolean每个多边形属性添加一个名为“selected”的属性,但我没有实现更新图层。

// Define polygons with properties
var features = [];
areas.forEach(area => features.push(turf.polygon(area.polygon, { id_area: area.id_area, name: area.name, selected: 'false' })));
features = turf.featureCollection(features);

map.on('load', function () {
    // Add polygons to map
    map.addSource('areas', {
        'type': 'geojson',
        'data': features
    });
    // Layer settings
    map.addLayer({
        'id': 'polygons',
        'type': 'fill',
        'source': 'areas',
        'paint': {
            'fill-color': [
                'match',
                ['get', 'selected'],
                'true', '#64bdbb', // if selected true, paint in blue
                '#888888' // else paint in gray
            ], …
Run Code Online (Sandbox Code Playgroud)

javascript mapbox mapbox-gl-js

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