小编fac*_*urn的帖子

为什么*ngIf与ng-template无关?

我在模板中有一个条件如下:

<ng-container>
    <p *ngFor="let seat of InfoDetails?.seatInfo">
        <template *ngIf="seat.section">
            Section {{seat?.section}} ,
        </template>
        <template *ngIf="seat.row">
            Row {{seat?.row}},
        </template>
        <template *ngIf="seat.seatNo">
            Seat number {{seat?.seatNo}}
        </template>
    </p>
</ng-container>
Run Code Online (Sandbox Code Playgroud)

我有包含row和的数据集seatNo,但它似乎没有在模板中打印.这是什么问题?

angular2-template ng-template angular

39
推荐指数
1
解决办法
4万
查看次数

AngularJS应用无法打开已配置的模态

我正在使用angularjs构建一个应用程序,我需要在其中显示一个页面,然后在用户粘贴url时打开一个包含详细信息的模式窗口。

路由器配置如下:

.state('main.legalentitites', {
    url: '/products/{productId:string}',
    views: {
        'content@': {
            templateUrl: 'app/views/productdetail.html',
            controller: 'productDetailCtrl',
        },
    },
})
.state('main.products.add', {
    url: '/products/{productId:string}/add',
    onEnter: function($state, $modal) {
        $modal
            .open({
                templateUrl: 'app/views/productModal.html',
                resolve: {},
                controller: 'ProductCtrl',
            })
            .result.then(function(result) {
                if (result) {
                    return $state.transitionTo('main.products')
                }
            })
    },
})
.$urlRouterProvider.otherwise(function($injector, $location) {
    var $state = $injector.get('$state')
    $state.go('main.home')
})
Run Code Online (Sandbox Code Playgroud)

当我输入url时https://localhost:44821/products/6cbc799a-fdc8-4e4d-ac27-0a5165423641/add,它不会导航到页面,并且模式也不会打开。控制台中也没有错误。它总是转到否则配置的部分。可能是什么问题?

javascript angularjs

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

为什么我的ViewModel字段在HTML编码时变为空?

我正面临一个奇怪的问题,有时候我会从sendgrid获取网址

https://开头本地主机:81 /激活username=ats8@test.com&activationToken=EAAAAA

哪个工作正常.但有时我得到的网址编码如下,

" https:// localhost:81/Activation?username = ats8%40test.com&activationToken = EAAAAA "

我的ViewModel如下,

  public class Verification
    {
        [DataType(DataType.EmailAddress)]
        public string Username { get; set; }

        [Required]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Compare("Password")]
        public string ConfirmPassword { get; set; }

        public string ActivationToken { get; set; }

    }
Run Code Online (Sandbox Code Playgroud)

方法如下,

 public ActionResult Activation(string username, string activationToken)
        {
            var model = new Verification
            {
                Username = username,
                ActivationToken = activationToken
            };

            return View(model);
        }
Run Code Online (Sandbox Code Playgroud)

在第二种情况下,activationToken为null.即使url被编码,我如何检测activationToken?

c# asp.net-mvc

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

我如何每1秒钟致电服务并使用angular2检查响应?

我执行了以下服务,

export class UploadPollingService {
    constructor(private http: Http, private appConfig: AppConfigService) { }
    checkUploadInfo(term: string, ): Observable<Event[]> {
        return this.http
            .get(this.appConfig.getAPIUrl() + `/checkStatus?processId=${term}`)
            .map(this.extractData)
            .catch(this.handleErrors);
    }
Run Code Online (Sandbox Code Playgroud)

我在组件内部使用它,我想每1秒调用一次此服务并检查状态,基本上是进行轮询。怎么做?

this.uploadPollingService.checkUploadInfo()
Run Code Online (Sandbox Code Playgroud)

polling typescript angular

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

如何在整数c#周围括起引号?

我正在使用以下内容对文档db进行动态查询

 var i = saList[index];
 engagementFilter.Append($"f.keys.SelectedEngagementId  = {i}");
Run Code Online (Sandbox Code Playgroud)

这会产生查询

(f.keys.SelectedEngagementId = f9721f2e-144d-40b9-b530-fcf067cab682或f.keys.SelectedEngagementId = f55dd402-9975-4c55-8486-6cb9c6330a66)

但我需要在guid附近引用,我该怎么做?

(f.keys.SelectedEngagementId ="f9721f2e-144d-40b9-b530-fcf067cab682"或f.keys.SelectedEngagementId ="f55dd402-9975-4c55-8486-6cb9c6330a66")

c# string guid azure-cosmosdb

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

我如何在订阅中控制记录结果?

在我的角度应用程序中,我正在调用服务并获取数据,我需要在获取结果后添加控制台日志.我在哪里可以添加控制台日志?

 this.searchTerm.asObservable()
            .debounceTime(300)      
            .distinctUntilChanged() 
            .switchMap(term => this.doFind(term))
            .subscribe(data => this.results = data
            , error => {
                this.errorMessage = error;
            });
Run Code Online (Sandbox Code Playgroud)

console typescript angular

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