详解如何使用webpack+es6开发angular1.x(2)

class Header { constructor($scope){ 'ngInject'; $scope.isshow = false; } } export default class header { constructor() { this.restrict = 'E', this.scope = {}, this.template = require(./header.html) this.controller = Header this.link = (scope, element, attr) => {} } }

header/header.html

<div> <a href="#home" >home</a> <a href="#router" >router</a> </div>

4.home

home/index.js

import angular from "angular"; import HomeController from './controller'; export default angular.module('app_home',[]) .controller('HomeController', HomeController)

home/controller.js

export default class HomeController { constructor($scope) { 'ngInject'; this.isshow = false; this.eage = 'sds'; $scope.edg = 'sma' } change(){ this.isshow = !this.isshow; console.log(this.isshow); } }

home/home.html

<div>home {{HMC.eage}} -- {{edg}}</div>

其余的模块大同小异就不依依去写了。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wydgss.html