These are chat archives for AngularClass/NG6-starter

19th
Feb 2016
Sergey Protko
@fesor
Feb 19 2016 08:00
@icylabsDev
import tpl1 from './template1.html';
import tpl2 from './template2.html';
// ...
template: function (el, attr) {
    if (attr.type === 'first') {
         return tpl1;
    }

    return tpl2;
}
@foucdeg there is not "ng6" style for this. The only difference is modules.
export default function ($q, $timeout) {
    "ngInject";

    return {
         require: 'ngModel',
         link: function(scope, el, attr, ctrl) {
             // ...
         }
    }
}
Diogo Afonso Barroso
@icylabsDev
Feb 19 2016 09:31
import templates from '../util/templates'
app.run(...
for (var key in templates) {
    $templateCache.put(key+'.html', templates[key]);
  }
import quizEdit from '../templates/exercises/quiz/quiz.html'
import textEdit from '../templates/exercises/text/text.html'

export default {
  quizEdit : quizEdit,
  textEdit : textEdit,
}
````
<div ng-include src="vm.exercise.staticName+'Edit.html'" ></div>
I made it work like this
then for new tempaltes I only have to add them to the templates.js file
@fesor might not be the perfect solution. but I'm short on time right now. and it is as dynamic as I need
András Iványi
@andyskw
Feb 19 2016 11:18
Hey everyone!

I would like to add an NG6-starter based application to a classic CI/CD pipeline: Some static analysis, then package build, then unit tests, then etc, and I do not want to break the principle of "Test against the artifact that you are going to deploy" principle. Since karma currently builds the application for itself, it does not really rely on the artifact, that is going to be deployed, even though by the stage karma runs, it is already built.

My question is, if you have any idea/practice/example/experience with this topic?

I am experimenting with the ´files´ option of karma config, but I guess, spec.bundle.js must be notified about that the imports that it is going to find in the spec files will point to the webpack bundle, or alternatively spec.bundle.js should be webpacked in app build time.