最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

angular - Why is ng-repeat not processed - Stack Overflow

programmeradmin2浏览0评论

I have been following some user guides / introduction videos, and am struggling to merge a couple of very basic concepts. I have trying to populate a SELECT using the ng-options but it seems its entirely ignored, and appears in the final HTML

I have appponent.html:


    Please pick an option
    <select ng-options="x for x in myData">
    

I have apppontents.ts:


    import { Component, OnInit } from '@angular/core';

    @Component({
      selector: 'app-root',
      templateUrl: './appponent.html',
      styleUrl: './appponent.css'
    })
    export class AppComponent implements OnInit {

      myData = ['Yes', 'No'];

      constructor() {}

      ngOnInit(): void {}
    }

Its as though ng-options and ng-repeat is not a thing - I can type any old rubbish into them and it just outputs to the HTML

发布评论

评论列表(0)

  1. 暂无评论