小编Tre*_*pps的帖子

使用ocLazyLoad延迟加载带有$ stateProvider的控制器

我在使用带有$ stateProvider的oclazyload时遇到了问题.

我已经指定控制器.js应该加载到路由器配置中,并且确实如此,但它不能用作templateURL中加载的文件中的ng-controller属性.

ui-route配置:

core
.run(
    [                    '$rootScope', '$state', '$stateParams',
        function ($rootScope,       $state,     $stateParams) {
                $rootScope.$state = $state;
                $rootScope.$stateParams = $stateParams;              
        }
    ]
)
.config(
    [                    '$stateProvider', '$urlRouterProvider',
        function ($stateProvider,       $urlRouterProvider) {
            console.info('Routing ...');
            $urlRouterProvider
                .otherwise('/app/dashboard');

            $stateProvider
                .state('app', {
                    abstract: true,
                    url: '/app',
                    templateUrl: 'templates/app.html',
                })
                .state('app.orders', {
                    abstract: true,
                    url: '/orders',
                    templateUrl: 'templates/orders/orders.html',
                })
                .state('app.orders.index', {
                    url: '/index',
                    templateUrl: 'templates/orders/index.html',
                    resolve: {
                        deps: ['$ocLazyLoad',
                            function( $ocLazyLoad ){
                                console.info('Path ot order controller in route config',Momento.paths.js + 'controllers/orders/index.js');
                                return $ocLazyLoad.load([
                                        Momento.paths.js …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angular-ui-router

8
推荐指数
2
解决办法
6721
查看次数

Google Firebase Cloud Functions 在使用 Firestore 并根据文档实施时产生错误

使用以下代码:

const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp()

exports.onTest = functions.https.onRequest(async (req, res) => {
  res.json({ msg: 'done' })
})
Run Code Online (Sandbox Code Playgroud)

这完全来自示例文档,...firebase emulators:start从 cli运行会生成以下错误:

 ?  TypeError: instance.registerVersion is not a function
    at registerDatabase (/Users/<path>/functions/node_modules/@firebase/database/dist/index.node.cjs.js:15188:14)
    at Object.<anonymous> (/Users/<path>/functions/node_modules/@firebase/database/dist/index.node.cjs.js:15200:5)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at FirebaseNamespace.get [as database] (/Users/tremendus/Development/kulanu/playground/kulanu-cloud/functions/node_modules/firebase-admin/lib/firebase-namespace.js:282:38)
?  We were unable to load your functions code. (see above)
Run Code Online (Sandbox Code Playgroud)

在SO和其他网站其他几个例子调用 …

firebase google-cloud-functions firebase-cli

5
推荐指数
1
解决办法
624
查看次数