我正在使用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)
任何帮助将不胜感激.
我当时正在做一个项目,一切都很顺利,直到我做到了npm install。
然后,Webpack 抛出以下错误:
\n\nnew 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) 我有一个灰色层来在 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)