React-Router使您的ReactJS应用程序可以通过简单的路由组件成为SPA.部署到IIS时,使用bashHistory进行设置时一切正常.但是,当我尝试使用browserHistory时,IIS正在尝试返回一个目录,而不是允许React-Router抓取并解析该路由.如何设置React-Router在IIS环境中工作?
我正在使用angular-fullstack生成器为我的应用程序生成新的路由.语法真的很陌生,并且使用类似于类的结构.我如何使用它来注入$ scope和$ watch之类的东西?我想做的主要是观察特定变量的变化.语法如下.有谁知道如何使用它?
'use strict';
(function() {
class MainController {
constructor($http) {
this.$http = $http;
this.awesomeThings = [];
$http.get('/api/things').then(response => {
this.awesomeThings = response.data;
});
}
addThing() {
if (this.newThing) {
this.$http.post('/api/things', { name: this.newThing });
this.newThing = '';
}
}
deleteThing(thing) {
this.$http.delete('/api/things/' + thing._id);
}
}
angular.module('myapp')
.controller('MainController', MainController);
})();
Run Code Online (Sandbox Code Playgroud)
如何注入$ watch以便我可以执行以下操作:
this.$watch('awasomeThings', function () { ... });
Run Code Online (Sandbox Code Playgroud)