有没有办法检查我的机器上全局安装的angular-cli的特定版本?我在Windows环境中. npm -v和node -v分别只给我npm和node的版本,我似乎无法找到任何带有ng的命令.
我正在尝试运行我正在进行的项目,并使用npm在旧版本的angular-cli上运行.但是,在安装其他演示项目之后,如果不卸载并重新安装特定版本的angular-cli,我的主项目将不再起作用.
除了在对象中呈现属性的值之外,我还想将属性名称呈现为标签.有没有办法做到这一点ng-repeat
?例如:
<ul>
<li ng-repeat="option in data">{{propertyName}}: {{option}}</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
哪个可能吐出这样的东西:
<ul>
<li>Name: John</li>
<li>Phone: (123) 456-7890</li>
<li>Country: England</li>
</ul>
Run Code Online (Sandbox Code Playgroud) 有没有办法在控制台中访问Angular2特定组件特定数据,以进行调试?
就像Angular1能够在控制台中访问其组件值一样.
<input type="file" accept="image/*">
<button>Upload file</button>
Run Code Online (Sandbox Code Playgroud)
如何从Angular 2中按钮的单击事件触发input type = file的click事件?
最近,ngrx商店改变了在角度应用程序中注册商店变量的方式.
StoreModule.forRoot()和StoreModule.forFeature()之间的区别是什么
我们是否需要注册才能使应用程序正常工作?
来自AngularJS noob的问题.
我正在尝试使用asmx Web服务来显示网格.我测试了Web服务,它正确输出了JSON数据.这是我的控制器
app.controller('SetupController', ['$scope', '$http', function ($scope, $http) {
var url = 'app/pricefilessetup/grid.asmx/getGridJson';
$http.get(url).success(function (data) {
var myjson = JSON.parse(data);
$scope.products= JSON.parse(myjson);
});
}]);
Run Code Online (Sandbox Code Playgroud)
出于某种原因,SO不允许我粘贴html,但它基本上有一个ng-controller指令和ng-repeat来循环遍历JSON数据.
当我运行这个Web应用程序时,我收到错误
SyntaxError:Object.parse(native)上的意外标记o,它指向以下行
$scope.questions = JSON.parse(myjson);
Run Code Online (Sandbox Code Playgroud)
我尝试使用alert检查myjson的值,它显示[object Object],[object Object],...
这里有什么我想念的吗?
我有一个父州,里面有两个孩子的州,我将根据这个州显示一个州URL
.
在这两个中有states
一个像param1
和的参数param2
,我params
在状态定义中使用了ui-router选项.
州
$stateProvider.state('tabs.account', {
url: '/account',
views: {
'content@tabs': {
templateUrl: 'account.html',
controller: function($scope, $stateParams) {
//This params are internally used to make ajax and show some data.
$scope.param1 = $stateParams.param1;
$scope.param2 = $stateParams.param2;
},
}
},
params: {
param1: { value: null }, //this are optional param
param2: { value: null } //because they are not used in url
}
});
Run Code Online (Sandbox Code Playgroud)
如果你看看我的路线,params选项并没有真正引入其中URL
,这就是为什么我当时认为是可选的.
看看plunkr,我已经显示了两个标签Account& …
javascript angularjs angular-ui angularjs-routing angular-ui-router
我需要有多个原始样式属性,如:
$scope.css = "'width': 'calc(100% - "+$scope.fixedColumnsWidth+"'),'margin-left':'"+ $scope.fixedColumnsWidth+"'";
<div ng-style="{css}">
Run Code Online (Sandbox Code Playgroud)
这不起作用.它在我使用时有效
<div style="{{css}}">
Run Code Online (Sandbox Code Playgroud)
但不适用于IE.
我试图将http提供程序导入服务,但是我收到以下错误:
无法解析'AppService'(?)的所有参数.确保所有参数都使用Inject进行修饰或具有有效的类型注释,并且"AppService"使用Injectable进行修饰.
以下是一些代码段:
<script src="~/es6-shim/es6-shim.min.js"></script>
<script src="~/systemjs/dist/system-polyfills.js"></script>
<script src="~/angular2/bundles/angular2-polyfills.js"></script>
<script src="~/systemjs/dist/system.src.js"></script>
<script src="~/rxjs/bundles/Rx.js"></script>
<script src="~/angular2/bundles/angular2.dev.js"></script>
<script src="~/angular2/bundles/http.dev.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
map: { 'rxjs': 'RCO/rxjs' },
packages: {
RCO: {
format: 'register',
defaultExtension: 'js'
},
'rxjs': {defaultExtension: 'js'}
}
});
System.import('RCO/Areas/ViewOrganization/AngularTemplates/boot')
.then(null, console.error.bind(console));
Run Code Online (Sandbox Code Playgroud)
boot.ts
import {bootstrap} from 'angular2/platform/browser'
import {HTTP_PROVIDERS} from 'angular2/http'
import 'rxjs/add/operator/map'
import {AppComponent} from 'RCO/Areas/ViewOrganization/AngularTemplates/app.component'
import {AppService} from 'RCO/Areas/ViewOrganization/AngularTemplates/app.service'
bootstrap(AppComponent, [HTTP_PROVIDERS, AppService]);
Run Code Online (Sandbox Code Playgroud)
app.service.ts
import {Injectable} from 'angular2/core';
import {Http, Response} from 'angular2/http';
import {Observable} …
Run Code Online (Sandbox Code Playgroud) typescript systemjs angular2-services angular2-injection angular
我使用Angular-Chart.js(AngularJS Chart.js版本)来创建条形图.图表正在使用除颜色之外的选项.
即使我设置它们,它在文档中指出,它们仍然是灰色的.
<div class="graph-display" ng-controller="chartController">
<canvas class="chart chart-bar"
data="bilans.data"
labels="bilans.labels"
series="bilans.series"
options="{
scaleShowHorizontalLines: true,
scaleShowVerticalLines: false,
tooltipTemplate: '<%= value %> $',
responsive: true
}"
colours="{
fillColor: 'rgba(47, 132, 71, 0.8)',
strokeColor: 'rgba(47, 132, 71, 0.8)',
highlightFill: 'rgba(47, 132, 71, 0.8)',
highlightStroke: 'rgba(47, 132, 71, 0.8)'
}"
></canvas>
</div>
Run Code Online (Sandbox Code Playgroud)
实际上,选项是有效的,但颜色不是.难道我做错了什么?
angular ×5
angularjs ×5
javascript ×3
angular-cli ×1
angular-ui ×1
bar-chart ×1
chart.js ×1
charts ×1
console ×1
css ×1
debugging ×1
file ×1
file-upload ×1
json ×1
ng-style ×1
ngrx-store ×1
node.js ×1
npm ×1
systemjs ×1
typescript ×1