zoukankan      html  css  js  c++  java
  • [AngularJS] New in Angular 1.3

    If you want to use controllers, instead of a link function, you can use bindToController.

    <!DOCTYPE html>
    <html ng-app="app">
    <head>
        <title>Egghead.io Tutorials</title>
        <style>body{padding:20px}</style>
        <link rel="shortcut icon" href="favicon.ico">
        <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
        <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.3/angular.js"></script>
        <script src="app.js"></script>
    </head>
    <body>
    
    <note message="hello"></note>
    </body>
    </html>
    angular.module("app", [])
    
        .directive("note", function note() {
            return {
                scope: {
                    message: "@" //pass in a string
                },
                bindToController: true,
                controller: "NoteCtrl as note",
                template: "<div>{{note.message}}</div>"
            };
        })
    
        .controller("NoteCtrl", function NoteCtrl() {
            var note = this;
        });

  • 相关阅读:
    01背包
    manacher马拉车算法
    盒子放球的DP
    Children’s Queue
    抽象类_作为接口
    斯特林数
    欧拉路HDU3018
    2019 SDN上机第三次作业
    第05组 Alpha冲刺(2/4)
    Alpha冲刺(1/4)
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4185504.html
Copyright © 2011-2022 走看看