我使用Xampp和JetBrain WebStorm来运行AngularJS项目.但它的复杂性和低性能.还有其他方法来运行AngularJS项目吗?
我有xf数组:var xf = [];
我有一个函数是这个数组中的一个元素和一个使用它的函数:
$scope.checkEmailValid = function () {
var result = false;
Iif (xf.validateEmail($scope.email, '256')) {
result = true;
}
return result;
};
xf.validateUsername = function (sText) {
var isValid = false;
do {
//Check for valid string.
isValid = typeof sText === 'string';
if (!isValid) {
break;
}
//Check that each special character does not exist in string.
for (var i = 0; i < sText.length; i++) {
if (xf.SPECIAL_CHARS.indexOf(sText.charAt(i)) !== -1) {
isValid = false; …Run Code Online (Sandbox Code Playgroud) 我是ReactJS的初学者.我在各种网站上学习和研究了很多文档和电子书.我意识到ReactJS有两种语法.例:
React.createClass({
displayName: 'Counter',
getDefaultProps: function(){
return {initialCount: 0};
},
getInitialState: function() {
return {count: this.props.initialCount}
},
propTypes: {initialCount: React.PropTypes.number},
tick() {
this.setState({count: this.state.count + 1});
},
render() {
return (
<div onClick={this.tick}>
Clicks: {this.state.count}
</div>
);
}
});
Run Code Online (Sandbox Code Playgroud)
这个版本是由ES6编写的:
class Counter extends React.Component {
static propTypes = {initialCount: React.PropTypes.number};
static defaultProps = {initialCount: 0};
constructor(props) {
super(props);
this.state = {count: props.initialCount};
}
state = {count: this.props.initialCount};
tick() {
this.setState({count: this.state.count + 1});
}
render() {
return (
<div onClick={this.tick.bind(this)}> …Run Code Online (Sandbox Code Playgroud) 我是React Native的新手.我正在使用React-Navigation.但是,在我的设备上有标题导航问题.这样覆盖状态栏就像这样.
我的代码和React Navigation展示示例都会出现此问题.怎么解决?谢谢
我有一个循环ng-repeat
<div ng-repeat="data in datas">
Name: {{data.name}} <input type="text" ng-model="age">
</div>
Run Code Online (Sandbox Code Playgroud)
我想$scope.age成为$scope.age_data.name.例如:$ scope.age_Tan,$ scope.age_Jim ...所以我试过ng-model="age_{{data.name}}"但是它会出错.怎么解决这个?
我想使用自动完成使用Google Places API进行输入。这是我的代码:
var options = {
componentRestrictions: {
country: "de"
}
};
var place = '';
var locationAutocompleteOneWay = document.getElementById('locationAutocompleteOneWay');
var autocompleteLocationOneWay = new google.maps.places.Autocomplete(locationAutocompleteOneWay, options);
google.maps.event.addListener(autocompleteLocationOneWay, 'place_changed', function() {
place = autocompleteLocationOneWay.getPlace();
});
Run Code Online (Sandbox Code Playgroud)
为了进行更多自定义,我想在文本框中输入内容时添加一些自定义位置结果。这是我的代码和结果:
setTimeout(function() {
$(".pac-container").append('<div id="areasearch" class="pac-item areasearch"><span class="pac-icon pac-icon-areas"></span><span class="pac-item-query"><span class="pac-matched"></span>Test place</span> <span>custom place</span></div>');
}, 500);
Run Code Online (Sandbox Code Playgroud)
但是我想当我单击结果时,它使我的输入locationAutocompleteOneWay具有该结果的值。但是我不知道该怎么做。而且我希望它可以在页面上申请多输入。我通过jQuery和AngularJS使用它。Jquery和AngularJS的所有解决方案对我都很好。在先进的感谢。
我的目标是在 React 中使用 iframe 构建一个组件,并能够处理该 iframe 上的单击事件。但是,onClick只有当我单击位于其包含的子 iframe 范围之外的父 div 时,我的事件才不会触发。有什么解决方案可以帮助我解决这个问题吗?谢谢。
export default function App() {
return (
<div className="App">
<div onClick={() => alert("Testing")}>
<iframe
src="https://google.com.vn"
title="stackoverflow"
style={{ width: "100%", height: "100%" }}
/>
</div>
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
我的沙箱: https://codesandbox.io/s/onclick-on-parent-of-iframe-jjigu ?file=/src/App.js
我在茉莉花的小型单位测试与Karma一起运行.但是,当我运行Karma时,它显示错误:
未捕获错误:[$ injector:nomod]模块'material.controllers'不可用!您要么错误拼写了模块名称,要么忘记加载它.如果注册模块,请确保将依赖项指定为第二个参数.
FAILED单元:LoginController遇到声明异常
ReferenceError:未定义模块
这是我的源代码,配置Karma文件和unitTest.
karma.conf.js
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'/home/tanpham/Angular/Dev/libs/angular/angular.js',
'/home/tanpham/Angular/Dev/js/**/*.js',
'/home/tanpham/Angular/Dev/js/*.js',
'/home/tanpham/Angular/Test/*.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: …Run Code Online (Sandbox Code Playgroud) 我有这样的输入设计:

但凭借我的风格,我不能那样做.
我的CSS:
input.custom[type=text]{
border: none;
border-bottom: 1px solid #00CCCB;
}
.custom::-webkit-input-placeholder {
color: #727272;
}
.custom:-moz-placeholder { /* Firefox 18- */
color: #727272;
}
.custom::-moz-placeholder { /* Firefox 19+ */
color: #727272;
}
.custom:-ms-input-placeholder {
color: #727272;
}
Run Code Online (Sandbox Code Playgroud)
我的HTML:
<input type="text" class="custom" placeholder="Text goes here"/>
Run Code Online (Sandbox Code Playgroud)
结果:

如何设置带有底部边框和微小左,右边框的输入,就像在我的设计中一样?
我正在尝试在加载页面组件时处理按键事件。首先,我有一个路由器:
<Router>
<Route exact path="/" component={Home} />
</Router>
Run Code Online (Sandbox Code Playgroud)
在家庭组件中,我尝试将onKeyPress绑定到div元素中,但是它不起作用。我将其绑定到输入元素,它的工作。
return (
<div onKeyDown={this.__handleKeyDown} className="container" style={{ backgroundImage: `url(${this.state.backgroundbanner})` }}>
<input
className="hidden"
onKeyDown={this.__handleKeyDown}
ref={(input) => { this.dummyInput = input; }}
/>
<div className="container-shadow">
<h1 className="main-title">{this.state.title}</h1>
<h3 className="main-description">{this.state.description}</h3>
<ListMovie cursor={ cursor } />
</div>
</div>
)
Run Code Online (Sandbox Code Playgroud)
如何在div元素上绑定事件onKeyDown或在Route中加载页面组件时如何绑定键事件。因为,输入元素可能会散焦,并且此按键事件无法执行。
谢谢。
我正在使用 Facebook Pixel 在我的网站上进行跟踪。
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'xxxxxxxxxxxxx');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=320956065128864&ev=PageView&noscript=1"
/></noscript>
Run Code Online (Sandbox Code Playgroud)
任何停止或过滤像 GA 过滤器的解决方案排除域或 IP?谢谢。
我对 Jasmine 进行了单元测试。当我运行这个单元测试时,它没有任何错误,但是当我在代码覆盖率中查看它时。它显示一些错误消息:“声明未涵盖”

我想解决这个错误。我能做什么?谢谢
javascript ×7
angularjs ×6
reactjs ×3
html ×2
unit-testing ×2
css ×1
ecmascript-6 ×1
iframe ×1
istanbul ×1
jasmine ×1
jquery ×1
keypress ×1
react-jsx ×1
react-native ×1
react-router ×1
syntax ×1
tracking ×1