Bundling và Minification là 2 công nghệ giúp bạn giảm thời gian tải dữ liệu của 1 trang web. Giải pháp là giảm số lượng yêu cầu tới server và giảm kích thước file (javascript và css). Đối với trường hợp jquery, javascript, giải pháp này phát huy được tính hiệu quả. Nhưng với AngularJs hoặc với KnockoutJs thì sẽ gặp trường hợp lỗi do UI data binding với tên biến ($scope.variable-name) nằm trong hàm javascript. Đầu tiên bạn thiết lập đường dẫn file cần nén và mã hóa trong BundleConfig.cs: bundles.Add(new ScriptBundle("~/bundles/home-module").Include( "~/Scripts/app/home-module.js")); File: home-module.js chứa ứng dụng viết bằng Angularjs (function () { 'use strict'; // Module name is handy for logging var id = 'home_module'; // Create the module and define its dependencies. var home_module = angular.module('home_module', []); home_module.constant('yourApp', 'AbtTest'); home_module.fac...
Suy nghĩ, yêu thương và làm việc hết mình