[AngularJS] New in Angular 1.3 - Performance Boost with debugInfoEnabled

By default, Angular provides a lot of debug information on the DOM that‘s only necessary for tools like Protractor and Batarang. Angular 1.3 allows you to turn off the debug information to give your app a simple performance boost.

See: https://docs.angularjs.org/api/ng/provider/$compileProvider

More: https://docs.angularjs.org/guide/production#disabling-debug-data

<!DOCTYPE html>
<html ng-app="app">
<head>
    <title></title>
    <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="//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.11/angular-ui-router.js"></script>
    <script src="app.js"></script>
</head>
<body>
  <script type="text/ng-template" id="templates/home.html">
    <note message="Hello"></note>
  </script>

<ui-view></ui-view>

</body>
</html>
angular.module("app", ["ui.router"])

    .config(function config($stateProvider, $compileProvider) {
        $stateProvider.state("home", {
            url: "",
            templateUrl: "templates/home.html"
        })

        $compileProvider.debugInfoEnabled(false);
    })

    .directive("note", function note() {
        return {
            template: "<div>{{ note.message }} {{ note.person }}</div>",
            controller: "NoteController as note",
            bindToController: true,
            scope: {
                message: "@"
            }
        }
    })

    .controller("NoteController", function NoteController() {
        var note = this;

        note.person = "John";
    })

Without debug info:

If you want open the debug info again:

in console:

angular.reloadWithDebugInfo();

时间: 2024-12-29 07:22:00

[AngularJS] New in Angular 1.3 - Performance Boost with debugInfoEnabled的相关文章

[AngularJS] Enable Animations Explicitly For A Performance Boost In AngularJS

http://www.bennadel.com/blog/2935-enable-animations-explicitly-for-a-performance-boost-in-angularjs.htm?utm_campaign=NG-Newsletter&utm_medium=email&utm_source=NG-Newsletter_119 angular.module( "Demo" ).config( function configureAnimate(

[AngularJS] Lazy loading Angular modules with ocLazyLoad

With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading of Angular modules in large applications. 'use strict'; // Declare app level module which depends on filters, and services var App = angular.module('

[Angular] USING ZONES IN ANGULAR FOR BETTER PERFORMANCE

Link to the artical. Zone detects any async opreations. Once an async oprations happens in Angular, Zone will notify change detection to kick in. Images we have 5000 svg box displaying on the screen. And each svg elements and three event listener on

[AngularJS] Exploring the Angular 1.5 .component() method

Angualr 1.4: .directive('counter', function counter() { return { scope: {}, restrict: 'EA', transclude: true, bindToController: { count: '=' }, controller: function () { function increment() { this.count++; } function decrement() { this.count--; } th

[AngularJS - thoughtram] Exploring Angular 1.3: Binding to Directive Controllers

The post we have: http://www.cnblogs.com/Answer1215/p/4185504.html gives a breif introduce about bindToController on the directive. Here is a blog about bindToController from thoughtramwhich explains in detail why bingToController comes into handy an

[AngularJS] New in Angular 1.3 - bindToController

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>

[AngularJS] Using the Angular scope $destroy event and method

With Angular scopes, you have access to a $destroy event that can be used to watch $scope events. This is used for cleanup, and gives you a final opportunity to access any data on a scope. Scopes also have a (rarely used) $destroy method that allows

AngularJS操作DOM——angular.element

addClass()-为每个匹配的元素添加指定的样式类名after()-在匹配元素集合中的每个元素后面插入参数所指定的内容,作为其兄弟节点append()-在每个匹配元素里面的末尾处插入参数内容attr() - 获取匹配的元素集合中的第一个元素的属性的值bind() - 为一个元素绑定一个事件处理程序children() - 获得匹配元素集合中每个元素的子元素,选择器选择性筛选clone()-创建一个匹配的元素集合的深度拷贝副本contents()-获得匹配元素集合中每个元素的子元素,包括文字和

[AngularJS] Sane, scalable Angular apps are tricky, but not impossible.

Read fromhttps://medium.com/@bluepnume/sane-scalable-angular-apps-are-tricky-but-not-impossible-lessons-learned-from-paypal-checkout-c5320558d4ef ng-Controller is bad, use directive instead. Don't specfiy controller in Route, use directive in templat