ByRoxana Hadadi,
a Vulture TV critic who also covers film and pop culture
Assad Zaman, the star of Interview With the Vampire’s audacious second season, guesses where his shape-shifting character can go next.
Photo: Courtesy AMC+
Louis de Pointe du Lac has a type, and it’s pretty bad. So bad his preference for ruinous eternal companions was a primary source of dramatic tension in Interview With the Vampire’s bold second season, featuring Assad Zaman’s Armand, a bad boyfriend for the ages. In a series that has explicitly used its titular interview to explore how truth, memory, and objectivity are malleable things, the unmasking of Armand as far from the nice guy he’s presented himself to be was a major moment and one that Zaman anticipated with equal parts obsequiousness and menace.
In the season finale, “And That’s the End of It. There’s Nothing Else” (spoilers on that episode follow), journalist Daniel Molloy reveals that Armand has lied to Louis for decades about his role in the deaths of Louis’s vampire sister-daughter Claudia and her companion Madeleine Éparvier and has tinkered with Louis’s memory more than once to make himself look better. Armand (formerly known as Rashid) isn’t exactly “the love of my life,” as Louis said of the Théâtre des Vampires troupe and coven leader in the first-season finale. He’s a Machiavellian opportunist, a trauma survivor whose primary means of showing love is exerting control, and whose betrayal of Louis leads to a blowup fight between the two immortals and the vampiric transformation of Molloy, turned off-screen by Armand as a kind of final “fuck you” to Louis.
But all terrible actions considered, Armand is, like Louis and Louis’s former lover and maker Lestat de Lioncourt (Sam Reid) — who also happens to be Armand’s ex-boyfriend, because the vampire dating pool is small — an embodiment of the loneliness of eternal life. Zaman’s performance is a marvel of control, with every minuscule head tilt, squint, and “serious theater director” arms-crossed pose conveying the belief that his centuries of experience allow him such maneuvers. There’s a pitiful quality to Armand’s seeming inability to understand love as an emotion that can’t be negotiated or strong-armed, and Zaman captures that aspect of the character in his soft eyes and pleading line deliveries, too. How much of this personality is the real Armand is a question for the series’ third season, which Zaman is eager to answer himself.
“Fingers crossed, everything goes well and we go into another season,” Zaman explained in an interview conducted before AMC announced the series’ renewal. “There’s nothing to say that we don’t see a completely new facet to him now because he’s been exposed; that mask is off now. I’m really, really curious to see what happened in Dubai after Louis left that room.”
There are a lot of scenes this season where Louis and Armand are speaking through telepathy, and we hear it as voice-over narration. Do you have a specific emotional headspace you’re in for those sequences, where you’re communicating so much nonverbally in your facial expressions? Some of those sequences that are early on in episodes two and three, you’re seeing big moments in Paris where you think a lot of time has passed. But not a lot of time has passed when we go back to Dubai. Those scenes we would often run right together: We would sit and do them in real time, and in between, we’d break, sort of pause, gather ourselves. In those moments with the three actors, we would whisper to each other, “What am I feeling here? This has just happened,” or “What part of the flashback are we referring to here?” Those exercises were really useful. When you talk about method, I’ve said this before — I don’t think I have a tried-and-tested process. I’m not super spiritual about acting. I have my curiosities, and the questions that I ask are the ways that I can find a process. Music was a big one for me with this show.
Is there anything you can share with me from the Armand playlist? I told showrunner Rolin Jones about one of the songs in it. No, the rest of it is mine, I’m afraid. It’s quite special to me.
Let me ask that a different way. Was there a certain emotional through-line or experience that you wanted to achieve through the playlist? There was. There was an end point, or a cliff, I wanted to jump off, or a peak that I wanted to reach, and that was finding the truth in Armand’s trauma. What that tastes like, feels like, sounds like in the voice. That was one of my biggest sort of challenges with this show, with this season, with this character, because he’s extremely complex. The actions that he takes — when I first read the scripts, it took a lot for me to understand how he gets to those places, or why he does the things he does. I curated the music around trying to get to a place where I could understand and empathize with his decisions without condoning them, because I think what’s interesting about Armand is often he knows how awful his actions might be, yet he does them anyway.
And that is a symptom, I think, of the curse of immortality, where the consequences of your actions weigh less on you because you know you have eternity to get over it, or your lover has an eternity to get over it. So what are you willing to do or sacrifice when the consequence is just time?
You’ve previously said there were “six or seven versions of Armand” this season. He’s always performing a different version of himself: when he was posing as the servant Rashid in season one, and then to Daniel, Louis, and the coven in season two. Did you want these versions of Armand to feel distinct and different while we’re watching, or did you want them to seem like one uniform person until the end of the season, when we realize how much Armand has deceived Louis and Molloy? Differentiating them was on my mind early on. Even in season one, Rolin and I had lightly discussed his voice. Is the way he sounds as Rashid going to be the way he sounds as Armand? And at that time, I wasn’t sure yet. I hadn’t made the decision. I didn’t know what Armand’s voice in Paris was going to sound like. But for me, the realization came after watching season one, and especially seeing Sam and watching how he’d placed Lestat and where his voice was. I was like, It has to be different. There’s something otherworldly; the vastness of time, you can hear in his voice. I decided Armand can’t just sound super contemporary all the time. He’s been living in Paris for 200 years, he will have been speaking French, his accent has to slip into a Parisian accent. My question was, if we hear Armand as French in Paris, will we believe that he’s sort of slipped out of that accent by the time we get to Dubai?
But as I was working through it, the chameleon-Armand aspect started showing itself; the fact that his self-preservation technique, one of them, is constantly code-switching and adapting. I know people whose accent just flips like a dime, and they often don’t realize that they’re doing it. And so it became quite easy to believe that he would have an American accent next week if he needed to do that to survive or convince someone of something. I’m not fully sure that we’ve even heard a true voice for Armand yet. I’m not sure. Fingers crossed, everything goes well and we go into another season. There’s nothing to say that we don’t see a completely new facet to him now because he’s been exposed; that mask is off now. I’m really, really curious to see what happened in Dubai after Louis left that room. Maybe he’ll sound completely different. I don’t know.
Were there physical components to that differentiation, or was his voice the central part for you? The voice came first. We started filming the fifth episode, and I’d been working on the voice — it sounds wanky saying “the voice” — but his essence was vocal, because the writing lends itself to it. When I got the scripts, I just focused on that so much. The physicality started when we got to our first Paris scenes and learned who Armand was in this era. Levan Akin, our director, who directed four episodes this season, really helped with finding this sort of alienness to Armand, which I had thought about but not really found until he’d unlocked it. He loves the books, knows the characters really, really well, and he etched out this ethereal, alien side of Armand. My natural sort of resting state is quite scatty. My hands move around everywhere, my rhythm is very fast and inarticulate and often a bit wishy-washy. And my first scene with Levan, he really sort of pinned me down — didn’t physically, but could have physically [laughs] — and said, “Stop. What are you doing, or what are you trying to achieve? And who are you? Remember, you’re 514 years old. You are ancient. You’re an ancient vampire.” He would constantly keep reminding me, and yeah, I think it rubbed off.
You said earlier that if there is a season-three pickup, we could get a differently voiced Armand because he’s mask-off now. He’s no longer spinning a version of himself to Louis or a version of himself to Daniel. Were there any scenes in season two that you played as him being honest with himself, as saying what he really feels? I think there’s two moments where you get to sit with an Armand who, for a couple of minutes, lets his guard down a little bit. The first is in episode four, when he talks about Amadeo in the Louvre, and the second is in episode six with Madeleine, when he’s debating whether he should make her into a vampire. The first one is a window into Armand as Amadeo, the boy, and a glimpse into the trauma of his life and finding solace, meaning, and love in this other ancient vampire when he meets Marius. He’s recounting his feelings toward Marius, especially when he says, “I served him with all my heart, basked in his mercy.” Those are completely true things. That’s the one time where he felt completely safe for the first time in his life, and I don’t think he’s ever felt safe after that. We who know the books will know what happened.
That scene was a bit of a revelation to me. There’s almost a camaraderie that builds between Armand and Madeline, maybe more toward Armand’s side. The thing that fascinates him about Louis is his fascination with humanity, because I don’t think Armand really has that fascination anymore. He’s kind of lost it. He goes into that scene with Madeleine talking to another human about becoming a vampire, and he thinks he’s talking to a piece of meat or an animal. And then something happens, and the curiosity takes over: in her strength, her ferocity, her wit, her wisdom. That last moment, where he sits down with her and says, “What will you do when she throws herself into the fire? Because she will,” and she says, “Maybe she won’t. You don’t know,” that moment is, I think, two equals.
After Armand shares his past as Amadeo, there is a new friction to his and Louis’s relationship: Armand was forced into sex work and Louis used to run a brothel. Did you, Jacob, or Rolin talk about that dynamic at all? I think it was in the air. We all were very aware of it. We didn’t have any deep discussions about it, but elements we would remember and point out in certain scenes. The park-bench scene at the end of the fourth episode, when Louis first calls him Arun and where Armand first calls him “Maître,” that’s the first time their dynamic shifts and this sort of dominant-submissive dynamic starts to evolve. There’s the scene in episode six where Louis brings the Jackson Pollock painting to Armand’s office, and he’s talking about the painting and he’s getting super turned on and he goes, “Face down, I want to fuck you.” Those were interesting little callbacks to who they both used to be, and Louis’s life before everything in New Orleans and Armand’s life as a sex worker — sex slave — and how, as coping mechanisms, they reverted back to those versions of themselves, which is so fucked up. It’s so fucked up to think about.
The final conversation between Daniel, Louis, and Armand completely changes where the show could go in a third season because it leads to Louis and Armand’s breakup and Armand turning Daniel into a vampire off-screen. What was the atmosphere like on set that day? I remember it being actually a really relaxed day, because it was one of the final days, and we all had been there for nine months living this sort of life together and we were all friends. We all got on really well. There wasn’t lots of tension. One of the joys about working with Jacob and Eric is the lightness that we bring to it. It’s so necessary, especially in those heavy moments, to have a laugh, because it can just become too much. We did that scene over two days, and when we first started it, Rolin described it as Molloy’s Columbo moment. You think it’s all worked out, everyone’s chilling out, and then he starts asking a few more questions.
“Just one more thing.” Exactly. And when that tone was set, we were like, “Ah, okay, that’s how it is. That’s how we should play it.” And it was fun. The moment when Louis leaves and I follow him, that we had to do a couple of times. The close-ups for that scene — like I’ve just mentioned when you were asking about the reactions, that was the day where that was really difficult, because for me, it’s so hard to play shock and surprise when I know what’s coming, and you’re really trying to sort of suspend your disbelief. Yeah, I found that really tricky. But again, Levan was such a rock. Even the hard moments didn’t become frustrating. You know the crew by then, everyone is on your side. We’ve been through the strike and we’re all just happy to be there. When the strike first happened, I thought, Oh, well, that was a nice dream. Time to go back to reality. We’re never gonna finish this thing. To finally finish it was such a relief.
Was there ever a version of the finale where we see Armand turn Daniel, or is that something we should look forward to potentially seeing in season three? I think that’s something we should look forward to.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(4),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(135),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"4":4,"12":12,"124":124,"135":135}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(406),Fingerprint2=require(408),DS=require(407),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(406),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"406":406,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]