(Angular)传递控制器实例以隔离范围

时间:2016-02-25 20:52:00

标签: angularjs directive angularjs-controlleras controlleras

虽然下面的代码"工作"但它肯定感觉非常错误。是否有"最佳实践"重构的方法?问题是我将控制器的实例传递给隔离范围指令

(注意:我不能在指令中使用它:

控制器:' ViewController', controllerAs:' viewCtrl',

因为我需要控制器的相同实例..)

可能只是我首先没有正确设置它,但很想知道是否有一个很好的方法来重构"此

UI-Router config:

        <some-dirctive
          view-ctrl="viewCtrl">
        </some-dirctive>

指令

server {
    listen   80 default_server;

    root /var/www/laravel/public/;
    index index.php index.html index.htm;

    location / {
         try_files $uri $uri/ /index.php$is_args$args;
    }

    # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
    location ~ \.php$ {
            try_files $uri /index.php =404;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
}

0 个答案:

没有答案