angulsrjs2.0---demo---使静态文字每秒随机变颜色

大神勿喷,在下是做后端的,才看了一点angularjs2.0,作为笔记,只为方便拿取....

<!doctype html>
<html>
<head>
	<meta charset="utf-8">
    <title>template - bind propery</title>
    <script type="text/javascript" src="lib/system@0.16.11.js"></script>
    <script type="text/javascript" src="lib/angular2.dev.js"></script>
    <script type="text/javascript" src="lib/system.config.js"></script>
</head>
<body>
	<ez-app></ez-app>
    
    <script type="module">
    	import {bind,Component,View,bootstrap} from "angular2/angular2";

        @Component({selector:"ez-app"})
        @View({
			template:`<h1 [style.color]="color">Hello,Angular2</h1>`
		})
        class EzApp{
        	constructor(){
            	this.color = "red";
                  var self = this;
                setInterval(function(){
                    self.color = '#'+(Math.random()*0xffffff<<0).toString(16); 
                },1000);
    		
            }
             
        }
                
        bootstrap(EzApp);

    </script>
</body>
</html>




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值